[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15924] trunk/blender/source/blender/src/ header_info.c: Copies all required DLLS for Save Game as Runtime.

Mal Duffin malachyduffin at gmail.com
Sat Aug 2 19:08:16 CEST 2008


Revision: 15924
          http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15924
Author:   mal_cando
Date:     2008-08-02 19:08:16 +0200 (Sat, 02 Aug 2008)

Log Message:
-----------
Copies all required DLLS for Save Game as Runtime.

Under Windows, all DLLs are copied to the same folder as the runtime .EXE, so that the process becomes a single click and deploy solution.

Linux doesn't require this ( thx for info centralnoise ) and will update to work on OS/X after I do a bit of research on .a and .so files ( thx for info kaito ).

Modified Paths:
--------------
    trunk/blender/source/blender/src/header_info.c

Modified: trunk/blender/source/blender/src/header_info.c
===================================================================
--- trunk/blender/source/blender/src/header_info.c	2008-08-02 16:51:11 UTC (rev 15923)
+++ trunk/blender/source/blender/src/header_info.c	2008-08-02 17:08:16 UTC (rev 15924)
@@ -540,6 +540,40 @@
 	}
 }
 
+static void copy_game_dll(char *dll_filename, char *source_dir, char *dest_dir)
+{
+	char source_filename[FILE_MAX];
+	char dest_filename[FILE_MAX];
+
+	strcpy( source_filename, source_dir );
+	strcat( source_filename, dll_filename );
+
+	strcpy( dest_filename, dest_dir );
+	strcat( dest_filename, dll_filename );
+	
+	if(!BLI_exists(dest_filename)) {
+		BLI_copy_fileops( source_filename, dest_filename );
+	}
+}
+
+static void copy_all_game_dlls(char *str)
+{
+#define GAME_DLL_COUNT		7
+	char *game_dll_list[GAME_DLL_COUNT]={"gnu_gettext.dll", "libpng.dll", "libtiff.dll", "pthreadVC2.dll", "python25.dll", "SDL.dll", "zlib.dll"};
+
+	char dest_dir[FILE_MAX];
+	char source_dir[FILE_MAX];
+	int i;
+
+	strcpy(source_dir, get_install_dir());
+	strcat(source_dir, "\\");
+	BLI_split_dirfile_basic(str, dest_dir, NULL);
+
+	for (i= 0; i< GAME_DLL_COUNT; i++) {
+		copy_game_dll(game_dll_list[i], source_dir, dest_dir );
+	};
+}
+
 static int write_runtime(char *str, char *exename)
 {
 	char *freestr= NULL;
@@ -587,7 +621,14 @@
 #endif
 
 	write_runtime(str, player);
+
+#ifdef _WIN32
+	// get a list of the .DLLs in the Blender folder and copy all of these to the destination folder if they don't exist
+	copy_all_game_dlls(str);
+#endif
 }
+
+
 /* end keyed functions */
 
 /************************** MAIN MENU *****************************/





More information about the Bf-blender-cvs mailing list