summaryrefslogtreecommitdiff
path: root/indra/llfilesystem/lldir_utils_objc.mm
diff options
context:
space:
mode:
authorMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-02-03 16:53:33 +0200
committerMaxim Nikolenko <maximnproductengine@lindenlab.com>2023-02-03 16:53:33 +0200
commit51142d1341bfd5f4f9749fe1aaf23d4f4270fe0e (patch)
tree1ced5dc14755b357886eb9fdf3606f5073ed9aaa /indra/llfilesystem/lldir_utils_objc.mm
parentdb80fdb55b646164a71c58e9f4751b368afa3b9f (diff)
parent8d21d29bd7fa038db632ff90fb0e1207d0713ca2 (diff)
Merge branch 'main' into DRTVWR-567
# Conflicts: # indra/newview/llappearancemgr.cpp # indra/newview/llpanelmaininventory.cpp
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);