diff options
author | Andrea Weikert <elubie@gmx.net> | 2010-07-04 19:35:23 +0400 |
---|---|---|
committer | Andrea Weikert <elubie@gmx.net> | 2010-07-04 19:35:23 +0400 |
commit | ca81aa704e958a73a55e79654f70eaa9a0fad85a (patch) | |
tree | 8b40e3a7613df4e707fcc8efb3a099f9445ac350 /intern | |
parent | 3ca7b160a664e74c6815056a4a8596bb4c2b70be (diff) |
Patch [#22339] File/installation paths changes
Patch Tracker: http://projects.blender.org/tracker/?func=detail&aid=22339&group_id=9&atid=127
This patch implements the proposal outlined here:
http://wiki.blender.org/index.php/Dev:2.5/Source/Installation/Proposal
Original patch by Matt Ebb.
Contributions by Nathan Letwory, Damien Plisson and Andrea Weikert
NOTE:
This is a work in progress commit, some work still needs to be done on the SCons and CMake files for this to work properly, but at least should compile and the files should be created in the right directory.
Commit discussed on IRC with Ton and Campbell.
Diffstat (limited to 'intern')
-rw-r--r-- | intern/ghost/GHOST_C-api.h | 14 | ||||
-rw-r--r-- | intern/ghost/GHOST_ISystem.h | 18 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_C-api.cpp | 12 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_System.h | 14 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCarbon.cpp | 20 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCarbon.h | 14 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.h | 14 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemCocoa.mm | 58 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.cpp | 10 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemWin32.h | 14 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.cpp | 19 | ||||
-rw-r--r-- | intern/ghost/intern/GHOST_SystemX11.h | 14 |
12 files changed, 0 insertions, 221 deletions
diff --git a/intern/ghost/GHOST_C-api.h b/intern/ghost/GHOST_C-api.h index a5fec1f101c..28fa72f9700 100644 --- a/intern/ghost/GHOST_C-api.h +++ b/intern/ghost/GHOST_C-api.h @@ -836,20 +836,6 @@ extern GHOST_TUns8* GHOST_getClipboard(int selection); */ extern void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection); -/** - * Determine the base dir in which shared resources are located. It will first try to use - * "unpack and run" path, then look for properly installed path, not including versioning. - * @return Unsigned char string pointing to system dir (eg /usr/share/blender/). - */ -extern const GHOST_TUns8* GHOST_getSystemDir(); - -/** - * 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/). - */ -extern const GHOST_TUns8* GHOST_getUserDir(); - #ifdef __cplusplus } diff --git a/intern/ghost/GHOST_ISystem.h b/intern/ghost/GHOST_ISystem.h index 8d80c74e140..b4dc88369f4 100644 --- a/intern/ghost/GHOST_ISystem.h +++ b/intern/ghost/GHOST_ISystem.h @@ -371,24 +371,6 @@ public: virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0; - /*************************************************************************************** - ** Determine special paths. - ***************************************************************************************/ - - /** - * Determine the base dir in which shared resources are located. It will first try to use - * "unpack and run" path, then look for properly installed path, not including versioning. - * @return Unsigned char string pointing to system dir (eg /usr/share/blender/). - */ - virtual const GHOST_TUns8* getSystemDir() const = 0; - - /** - * 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/). - */ - virtual const GHOST_TUns8* getUserDir() const = 0; - protected: /** * Initialize the system. diff --git a/intern/ghost/intern/GHOST_C-api.cpp b/intern/ghost/intern/GHOST_C-api.cpp index 9da20200f63..839d85c9617 100644 --- a/intern/ghost/intern/GHOST_C-api.cpp +++ b/intern/ghost/intern/GHOST_C-api.cpp @@ -865,15 +865,3 @@ void GHOST_putClipboard(GHOST_TInt8 *buffer, int selection) GHOST_ISystem* system = GHOST_ISystem::getSystem(); system->putClipboard(buffer, selection); } - -const GHOST_TUns8* GHOST_getSystemDir() -{ - GHOST_ISystem* system = GHOST_ISystem::getSystem(); - return system->getSystemDir(); -} - -const GHOST_TUns8* GHOST_getUserDir() -{ - GHOST_ISystem* system = GHOST_ISystem::getSystem(); - return system->getUserDir(); -} diff --git a/intern/ghost/intern/GHOST_System.h b/intern/ghost/intern/GHOST_System.h index d6c6a356323..2b45bfb86cf 100644 --- a/intern/ghost/intern/GHOST_System.h +++ b/intern/ghost/intern/GHOST_System.h @@ -297,20 +297,6 @@ public: */ virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const = 0; - /** - * Determine the base dir in which shared resources are located. It will first try to use - * "unpack and run" path, then look for properly installed path, not including versioning. - * @return Unsigned char string pointing to system dir (eg /usr/share/blender/). - */ - virtual const GHOST_TUns8* getSystemDir() const = 0; - - /** - * 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/). - */ - virtual const GHOST_TUns8* getUserDir() const = 0; - protected: /** * Initialize the system. diff --git a/intern/ghost/intern/GHOST_SystemCarbon.cpp b/intern/ghost/intern/GHOST_SystemCarbon.cpp index 5522a0736c4..a4011f89de6 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.cpp +++ b/intern/ghost/intern/GHOST_SystemCarbon.cpp @@ -1214,23 +1214,3 @@ void GHOST_SystemCarbon::putClipboard(GHOST_TInt8 *buffer, bool selection) const CFRelease(textData); } } - -const GHOST_TUns8* GHOST_SystemCarbon::getSystemDir() const -{ - return (GHOST_TUns8*)"/Library/Application Support/Blender"; -} - -const GHOST_TUns8* GHOST_SystemCarbon::getUserDir() const -{ - static char usrPath[256] = ""; - char* env = getenv("HOME"); - - if (env) { - strncpy(usrPath, env, 245); - usrPath[245]=0; - strcat(usrPath, "/Library/Application Support/Blender"); - return (GHOST_TUns8*) usrPath; - } - else - return NULL; -} diff --git a/intern/ghost/intern/GHOST_SystemCarbon.h b/intern/ghost/intern/GHOST_SystemCarbon.h index ebd929749b6..fd5c61fd7b6 100644 --- a/intern/ghost/intern/GHOST_SystemCarbon.h +++ b/intern/ghost/intern/GHOST_SystemCarbon.h @@ -190,20 +190,6 @@ public: */ virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const; - /** - * Determine the base dir in which shared resources are located. It will first try to use - * "unpack and run" path, then look for properly installed path, not including versioning. - * @return Unsigned char string pointing to system dir (eg /usr/share/blender/). - */ - virtual const GHOST_TUns8* getSystemDir() const; - - /** - * 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/). - */ - virtual const GHOST_TUns8* getUserDir() const; - protected: /** * Initializes the system. diff --git a/intern/ghost/intern/GHOST_SystemCocoa.h b/intern/ghost/intern/GHOST_SystemCocoa.h index b97c36f04a8..e97f8c70521 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.h +++ b/intern/ghost/intern/GHOST_SystemCocoa.h @@ -214,20 +214,6 @@ public: virtual void putClipboard(GHOST_TInt8 *buffer, bool selection) const; /** - * Determine the base dir in which shared resources are located. It will first try to use - * "unpack and run" path, then look for properly installed path, not including versioning. - * @return Unsigned char string pointing to system dir (eg /usr/share/blender/). - */ - virtual const GHOST_TUns8* getSystemDir() const; - - /** - * 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/). - */ - virtual const GHOST_TUns8* getUserDir() const; - - /** * Handles a window event. Called by GHOST_WindowCocoa window delegate * @param eventType The type of window event * @param window The window on which the event occured diff --git a/intern/ghost/intern/GHOST_SystemCocoa.mm b/intern/ghost/intern/GHOST_SystemCocoa.mm index 2cec24714be..00b00c69cee 100644 --- a/intern/ghost/intern/GHOST_SystemCocoa.mm +++ b/intern/ghost/intern/GHOST_SystemCocoa.mm @@ -1780,61 +1780,3 @@ void GHOST_SystemCocoa::putClipboard(GHOST_TInt8 *buffer, bool selection) const [pool drain]; } - -#pragma mark Base directories retrieval - -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"; - } - - /* 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; -} - -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"]; - } - - /* 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; -} diff --git a/intern/ghost/intern/GHOST_SystemWin32.cpp b/intern/ghost/intern/GHOST_SystemWin32.cpp index 91c1927f8e7..41cbb72c9b9 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.cpp +++ b/intern/ghost/intern/GHOST_SystemWin32.cpp @@ -1092,13 +1092,3 @@ void GHOST_SystemWin32::putClipboard(GHOST_TInt8 *buffer, bool selection) const return; } } - -const GHOST_TUns8* GHOST_SystemWin32::getSystemDir() const -{ - return NULL; -} - -const GHOST_TUns8* GHOST_SystemWin32::getUserDir() const -{ - return NULL; -} diff --git a/intern/ghost/intern/GHOST_SystemWin32.h b/intern/ghost/intern/GHOST_SystemWin32.h index e65393a4faa..84fca33238f 100644 --- a/intern/ghost/intern/GHOST_SystemWin32.h +++ b/intern/ghost/intern/GHOST_SystemWin32.h @@ -189,20 +189,6 @@ public: /** - * Determine the base dir in which shared resources are located. It will first try to use - * "unpack and run" path, then look for properly installed path, not including versioning. - * @return Unsigned char string pointing to system dir (eg /usr/share/blender/). - */ - virtual const GHOST_TUns8* getSystemDir() const; - - /** - * 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/). - */ - virtual const GHOST_TUns8* getUserDir() const; - - /** * Creates a drag'n'drop event and pushes it immediately onto the event queue. * Called by GHOST_DropTargetWin32 class. * @param eventType The type of drag'n'drop event diff --git a/intern/ghost/intern/GHOST_SystemX11.cpp b/intern/ghost/intern/GHOST_SystemX11.cpp index 052c868e5e0..f286f8ae7d3 100644 --- a/intern/ghost/intern/GHOST_SystemX11.cpp +++ b/intern/ghost/intern/GHOST_SystemX11.cpp @@ -1458,22 +1458,3 @@ void GHOST_SystemX11::putClipboard(GHOST_TInt8 *buffer, bool selection) const fprintf(stderr, "failed to own primary\n"); } } - -const GHOST_TUns8* GHOST_SystemX11::getSystemDir() const -{ - return (GHOST_TUns8*)"/usr/share/blender"; -} - -const GHOST_TUns8* GHOST_SystemX11::getUserDir() const -{ - static char path[256]; - char* env = getenv("HOME"); - if(env) { - strncpy(path, env, 245); - path[245]=0; - strcat(path, "/.blender/"); - return (GHOST_TUns8*) path; - } else { - return NULL; - } -} diff --git a/intern/ghost/intern/GHOST_SystemX11.h b/intern/ghost/intern/GHOST_SystemX11.h index ee6cbedb2ae..6a4ff1b41c7 100644 --- a/intern/ghost/intern/GHOST_SystemX11.h +++ b/intern/ghost/intern/GHOST_SystemX11.h @@ -227,20 +227,6 @@ public: void putClipboard(GHOST_TInt8 *buffer, bool selection) const; /** - * Determine the base dir in which shared resources are located. It will first try to use - * "unpack and run" path, then look for properly installed path, not including versioning. - * @return Unsigned char string pointing to system dir (eg /usr/share/blender/). - */ - const GHOST_TUns8* getSystemDir() const; - - /** - * 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/). - */ - const GHOST_TUns8* getUserDir() const; - - /** * Atom used for ICCCM, WM-spec and Motif. * We only need get this atom at the start, it's relative * to the display not the window and are public for every |