summaryrefslogtreecommitdiff
path: root/indra/llfilesystem/lldir_utils_objc.mm
diff options
context:
space:
mode:
authorAndrey Lihatskiy <alihatskiy@productengine.com>2022-11-02 18:50:18 +0200
committerAndrey Lihatskiy <alihatskiy@productengine.com>2022-11-02 18:50:18 +0200
commit67ce0e77d786b21c40e12b242e4646cfe6915e26 (patch)
tree5d02b1c7c14bdb4785c11c6979133c0c17cb88b1 /indra/llfilesystem/lldir_utils_objc.mm
parent21079869fce41940316e8a76719597d0dca0e17c (diff)
parent0c36fed11056511872afae14a39a88f5e46be0fc (diff)
Merge remote-tracking branch 'RyeMutt/viewer/mac-fixes' into DRTVWR-570-maint-Q
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);