summaryrefslogtreecommitdiff
path: root/indra/llfilesystem/lldir_utils_objc.mm
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2023-04-07 00:20:59 +0300
committerAndrey Lihatskiy <alihatskiy@productengine.com>2023-04-07 00:20:59 +0300
commitf1095d78315818642e62b7f4af9984557e176b5d (patch)
tree3606970e28e1101befbc7b42ccd6033cfd839e7b /indra/llfilesystem/lldir_utils_objc.mm
parent4042ed9701fcfa42c03fc285a757aa348f800e33 (diff)
parentc7053a6928fd5eafdc935453742e92951ae4e0c1 (diff)
Merge branch 'main' into marchcat/main-contrib-merge
# Conflicts: # indra/cmake/CMakeLists.txt # indra/llcommon/llsdserialize.cpp # indra/llcommon/llsdserialize.h # indra/llcommon/tests/llleap_test.cpp # indra/newview/llfilepicker.h # indra/newview/llfilepicker_mac.h # indra/newview/llfilepicker_mac.mm # indra/newview/skins/default/xui/en/strings.xml
Diffstat (limited to 'indra/llfilesystem/lldir_utils_objc.mm')
-rw-r--r--indra/llfilesystem/lldir_utils_objc.mm82
1 files changed, 41 insertions, 41 deletions
diff --git a/indra/llfilesystem/lldir_utils_objc.mm b/indra/llfilesystem/lldir_utils_objc.mm
index da55a2f897..20540fb93c 100644
--- a/indra/llfilesystem/lldir_utils_objc.mm
+++ b/indra/llfilesystem/lldir_utils_objc.mm
@@ -30,75 +30,75 @@
#include "lldir_utils_objc.h"
#import <Cocoa/Cocoa.h>
-std::string* getSystemTempFolder()
+std::string getSystemTempFolder()
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSString * tempDir = NSTemporaryDirectory();
- if (tempDir == nil)
- tempDir = @"/tmp";
- std::string *result = ( new std::string([tempDir UTF8String]) );
- [pool release];
+ std::string result;
+ @autoreleasepool {
+ NSString * tempDir = NSTemporaryDirectory();
+ if (tempDir == nil)
+ tempDir = @"/tmp";
+ result = std::string([tempDir UTF8String]);
+ }
return result;
}
//findSystemDirectory scoped exclusively to this file.
-std::string* findSystemDirectory(NSSearchPathDirectory searchPathDirectory,
+std::string findSystemDirectory(NSSearchPathDirectory searchPathDirectory,
NSSearchPathDomainMask domainMask)
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- std::string *result = nil;
- NSString *path = nil;
-
- // Search for the path
- NSArray* paths = NSSearchPathForDirectoriesInDomains(searchPathDirectory,
- domainMask,
- YES);
- if ([paths count])
- {
- path = [paths objectAtIndex:0];
- //HACK: Always attempt to create directory, ignore errors.
- NSError *error = nil;
-
- [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error];
-
+ std::string result;
+ @autoreleasepool {
+ NSString *path = nil;
- result = new std::string([path UTF8String]);
+ // Search for the path
+ NSArray* paths = NSSearchPathForDirectoriesInDomains(searchPathDirectory,
+ domainMask,
+ YES);
+ if ([paths count])
+ {
+ path = [paths objectAtIndex:0];
+ //HACK: Always attempt to create directory, ignore errors.
+ NSError *error = nil;
+
+ [[NSFileManager defaultManager] createDirectoryAtPath:path withIntermediateDirectories:YES attributes:nil error:&error];
+
+
+ result = std::string([path UTF8String]);
+ }
}
- [pool release];
return result;
}
-std::string* getSystemExecutableFolder()
+std::string getSystemExecutableFolder()
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- NSString *bundlePath = [[NSBundle mainBundle] executablePath];
- std::string *result = (new std::string([bundlePath UTF8String]));
- [pool release];
+ std::string result;
+ @autoreleasepool {
+ NSString *bundlePath = [[NSBundle mainBundle] executablePath];
+ result = std::string([bundlePath UTF8String]);
+ }
return result;
}
-std::string* getSystemResourceFolder()
+std::string getSystemResourceFolder()
{
- NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
-
- NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
- std::string *result = (new std::string([bundlePath UTF8String]));
- [pool release];
+ std::string result;
+ @autoreleasepool {
+ NSString *bundlePath = [[NSBundle mainBundle] resourcePath];
+ result = std::string([bundlePath UTF8String]);
+ }
return result;
}
-std::string* getSystemCacheFolder()
+std::string getSystemCacheFolder()
{
return findSystemDirectory (NSCachesDirectory,
NSUserDomainMask);
}
-std::string* getSystemApplicationSupportFolder()
+std::string getSystemApplicationSupportFolder()
{
return findSystemDirectory (NSApplicationSupportDirectory,
NSUserDomainMask);