[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [30004] trunk/blender/intern/ghost: File/ installation paths: osx (cocoa & carbon) update in ghost
Damien Plisson
damien.plisson at yahoo.fr
Mon Jul 5 21:59:37 CEST 2010
Revision: 30004
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=30004
Author: damien78
Date: 2010-07-05 21:59:37 +0200 (Mon, 05 Jul 2010)
Log Message:
-----------
File/installation paths: osx (cocoa & carbon) update in ghost
Modified Paths:
--------------
trunk/blender/intern/ghost/GHOST_Path-api.h
trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
Modified: trunk/blender/intern/ghost/GHOST_Path-api.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_Path-api.h 2010-07-05 19:59:27 UTC (rev 30003)
+++ trunk/blender/intern/ghost/GHOST_Path-api.h 2010-07-05 19:59:37 UTC (rev 30004)
@@ -45,8 +45,7 @@
/**
* Determine the base dir in which user configuration is stored, not including versioning.
- * If needed, it will create the base directory.
- * @return Unsigned char string pointing to user dir (eg ~/.blender/).
+ * @return Unsigned char string pointing to user dir (eg ~).
*/
extern const GHOST_TUns8* GHOST_getUserDir();
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp 2010-07-05 19:59:27 UTC (rev 30003)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp 2010-07-05 19:59:37 UTC (rev 30004)
@@ -1238,5 +1238,15 @@
const GHOST_TUns8* GHOST_SystemCarbon::getBinaryDir() const
{
- return NULL;
+ CFURLRef bundleURL;
+ CFStringRef pathStr;
+ static char path[256];
+ CFBundleRef mainBundle = CFBundleGetMainBundle();
+
+ bundleURL = CFBundleCopyBundleURL(mainBundle);
+ pathStr = CFURLCopyFileSystemPath(bundleURL, kCFURLPOSIXPathStyle);
+ CFStringGetCString(pathStr, path, 255, kCFStringEncodingASCII);
+ CFRelease(pathStr);
+ CFRelease(bundleURL);
+ return (GHOST_TUns8*)path;
}
Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm 2010-07-05 19:59:27 UTC (rev 30003)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm 2010-07-05 19:59:37 UTC (rev 30004)
@@ -1783,85 +1783,61 @@
#pragma mark Base directories retrieval
-// TODO: this should only return base path, remove the appending of Blender or .blender
const GHOST_TUns8* GHOST_SystemCocoa::getSystemDir() const
{
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSFileManager *fileManager;
NSString *basePath;
NSArray *paths;
paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSLocalDomainMask, YES);
if ([paths count] > 0)
- basePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Blender"];
- else { //Fall back to standard unix path in case of issue
- basePath = @"/usr/share/blender";
+ basePath = [paths objectAtIndex:0];
+ else {
+ [pool drain];
+ return NULL;
}
- /* Ensure path exists, creates it if needed */
- fileManager = [NSFileManager defaultManager];
- if (![fileManager fileExistsAtPath:basePath isDirectory:NULL]) {
- [fileManager createDirectoryAtPath:basePath attributes:nil];
- }
-
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
[pool drain];
return tempPath;
}
-// TODO: this should only return base path, remove the appending of Blenbder or .blender
const GHOST_TUns8* GHOST_SystemCocoa::getUserDir() const
{
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSFileManager *fileManager;
NSString *basePath;
NSArray *paths;
paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
if ([paths count] > 0)
- basePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Blender"];
- else { //Fall back to HOME in case of issue
- basePath = [NSHomeDirectory() stringByAppendingPathComponent:@".blender"];
+ basePath = [paths objectAtIndex:0];
+ else {
+ [pool drain];
+ return NULL;
}
-
- /* Ensure path exists, creates it if needed */
- fileManager = [NSFileManager defaultManager];
- if (![fileManager fileExistsAtPath:basePath isDirectory:NULL]) {
- [fileManager createDirectoryAtPath:basePath attributes:nil];
- }
-
+
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
[pool drain];
return tempPath;
}
-// TODO: this is same as getUserDir for now
const GHOST_TUns8* GHOST_SystemCocoa::getBinaryDir() const
{
static GHOST_TUns8 tempPath[512] = "";
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSFileManager *fileManager;
NSString *basePath;
- NSArray *paths;
-
- paths = NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
-
- if ([paths count] > 0)
- basePath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"Blender"];
- else { //Fall back to HOME in case of issue
- basePath = [NSHomeDirectory() stringByAppendingPathComponent:@".blender"];
- }
- /* Ensure path exists, creates it if needed */
- fileManager = [NSFileManager defaultManager];
- if (![fileManager fileExistsAtPath:basePath isDirectory:NULL]) {
- [fileManager createDirectoryAtPath:basePath attributes:nil];
+ basePath = [[NSBundle mainBundle] bundlePath];
+
+ if (basePath == nil) {
+ [pool drain];
+ return NULL;
}
strcpy((char*)tempPath, [basePath cStringUsingEncoding:NSASCIIStringEncoding]);
More information about the Bf-blender-cvs
mailing list