[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [29935] trunk/blender: Patch [#22339] File /installation paths changes

Andrea Weikert elubie at gmx.net
Sun Jul 4 17:35:24 CEST 2010


Revision: 29935
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=29935
Author:   elubie
Date:     2010-07-04 17:35:23 +0200 (Sun, 04 Jul 2010)

Log Message:
-----------
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.

Modified Paths:
--------------
    trunk/blender/SConstruct
    trunk/blender/intern/ghost/GHOST_C-api.h
    trunk/blender/intern/ghost/GHOST_ISystem.h
    trunk/blender/intern/ghost/intern/GHOST_C-api.cpp
    trunk/blender/intern/ghost/intern/GHOST_System.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
    trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemWin32.h
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.cpp
    trunk/blender/intern/ghost/intern/GHOST_SystemX11.h
    trunk/blender/release/scripts/ui/space_info.py
    trunk/blender/source/blender/blenfont/intern/blf_lang.c
    trunk/blender/source/blender/blenkernel/SConscript
    trunk/blender/source/blender/blenkernel/intern/blender.c
    trunk/blender/source/blender/blenlib/BLI_path_util.h
    trunk/blender/source/blender/blenlib/CMakeLists.txt
    trunk/blender/source/blender/blenlib/intern/BLI_bfile.c
    trunk/blender/source/blender/blenlib/intern/path_util.c
    trunk/blender/source/blender/blenloader/intern/writefile.c
    trunk/blender/source/blender/editors/interface/interface_icons.c
    trunk/blender/source/blender/editors/space_file/file_ops.c
    trunk/blender/source/blender/editors/space_file/fsmenu.c
    trunk/blender/source/blender/editors/space_file/fsmenu.h
    trunk/blender/source/blender/editors/space_file/space_file.c
    trunk/blender/source/blender/editors/space_image/SConscript
    trunk/blender/source/blender/editors/space_info/space_info.c
    trunk/blender/source/blender/makesrna/SConscript
    trunk/blender/source/blender/python/intern/bpy.c
    trunk/blender/source/blender/python/intern/bpy_interface.c
    trunk/blender/source/blender/windowmanager/intern/wm_files.c
    trunk/blender/source/blender/windowmanager/intern/wm_init_exit.c
    trunk/blender/source/blender/windowmanager/wm_files.h
    trunk/blender/source/creator/CMakeLists.txt
    trunk/blender/tools/Blender.py
    trunk/blender/tools/btools.py

Added Paths:
-----------
    trunk/blender/source/blender/blenlib/intern/path_util_cocoa.m

Modified: trunk/blender/SConstruct
===================================================================
--- trunk/blender/SConstruct	2010-07-04 14:36:59 UTC (rev 29934)
+++ trunk/blender/SConstruct	2010-07-04 15:35:23 UTC (rev 29935)
@@ -437,6 +437,8 @@
 #-- .blender
 #- dont do .blender and scripts for darwin, it is already in the bundle
 dotblendlist = []
+datafileslist = []
+datafilestargetlist = []
 dottargetlist = []
 scriptinstall = []
 
@@ -455,17 +457,26 @@
 					if f.endswith('.ttf'):
 						continue
 				
-				dotblendlist.append(os.path.join(dp, f))
-				if env['WITH_BF_FHS']:	dir= os.path.join(*([BLENDERPATH] + dp.split(os.sep)[2:]))	# skip bin/.blender
-				else:					dir= os.path.join(*([BLENDERPATH] + dp.split(os.sep)[1:]))	# skip bin
-				
-				dottargetlist.append(dir + os.sep + f)
+				if 'locale' in dp:
+					datafileslist.append(os.path.join(dp,f))
+					if env['WITH_BF_FHS']:	dir= os.path.join(*([BLENDERPATH] + ['datafiles'] + dp.split(os.sep)[2:]))	# skip bin/.blender
+					else:					dir= os.path.join(*([BLENDERPATH] + ['.blender'] + ['datafiles'] + dp.split(os.sep)[1:]))	# skip bin
+					datafilestargetlist.append(dir + os.sep + f)
+
+				else:
+					dotblendlist.append(os.path.join(dp, f))
+					if env['WITH_BF_FHS']:	dir= os.path.join(*([BLENDERPATH] + ['config'] + dp.split(os.sep)[2:]))	# skip bin/.blender
+					else:					dir= os.path.join(*([BLENDERPATH] + ['.blender'] + ['config'] + dp.split(os.sep)[1:]))	# skip bin
 					
-
+					dottargetlist.append(dir + os.sep + f)
+					
 		dotblenderinstall = []
 		for targetdir,srcfile in zip(dottargetlist, dotblendlist):
 			td, tf = os.path.split(targetdir)
 			dotblenderinstall.append(env.Install(dir=td, source=srcfile))
+		for targetdir,srcfile in zip(datafilestargetlist, datafileslist):
+			td, tf = os.path.split(targetdir)
+			dotblenderinstall.append(env.Install(dir=td, source=srcfile))
 		
 		if env['WITH_BF_PYTHON']:
 			#-- .blender/scripts

Modified: trunk/blender/intern/ghost/GHOST_C-api.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_C-api.h	2010-07-04 14:36:59 UTC (rev 29934)
+++ trunk/blender/intern/ghost/GHOST_C-api.h	2010-07-04 15:35:23 UTC (rev 29935)
@@ -836,21 +836,7 @@
  */
 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
 }
 #endif

Modified: trunk/blender/intern/ghost/GHOST_ISystem.h
===================================================================
--- trunk/blender/intern/ghost/GHOST_ISystem.h	2010-07-04 14:36:59 UTC (rev 29934)
+++ trunk/blender/intern/ghost/GHOST_ISystem.h	2010-07-04 15:35:23 UTC (rev 29935)
@@ -371,24 +371,6 @@
 	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.

Modified: trunk/blender/intern/ghost/intern/GHOST_C-api.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_C-api.cpp	2010-07-04 14:36:59 UTC (rev 29934)
+++ trunk/blender/intern/ghost/intern/GHOST_C-api.cpp	2010-07-04 15:35:23 UTC (rev 29935)
@@ -865,15 +865,3 @@
 	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();
-}

Modified: trunk/blender/intern/ghost/intern/GHOST_System.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_System.h	2010-07-04 14:36:59 UTC (rev 29934)
+++ trunk/blender/intern/ghost/intern/GHOST_System.h	2010-07-04 15:35:23 UTC (rev 29935)
@@ -297,20 +297,6 @@
 	   */
 	  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.

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp	2010-07-04 14:36:59 UTC (rev 29934)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.cpp	2010-07-04 15:35:23 UTC (rev 29935)
@@ -1214,23 +1214,3 @@
 		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;
-}

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h	2010-07-04 14:36:59 UTC (rev 29934)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCarbon.h	2010-07-04 15:35:23 UTC (rev 29935)
@@ -190,20 +190,6 @@
 	 */
 	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.

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h	2010-07-04 14:36:59 UTC (rev 29934)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.h	2010-07-04 15:35:23 UTC (rev 29935)
@@ -214,20 +214,6 @@
 	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

Modified: trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm
===================================================================
--- trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm	2010-07-04 14:36:59 UTC (rev 29934)
+++ trunk/blender/intern/ghost/intern/GHOST_SystemCocoa.mm	2010-07-04 15:35:23 UTC (rev 29935)
@@ -1780,61 +1780,3 @@
 	
 	[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;
-}
-

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list