Cycles: svn merge -r41225:41232 ^/trunk/blender
[blender.git] / source / gameengine / GamePlayer / ghost / GPG_ghost.cpp
index f5bd3a91c265c4a7a4b17c829ab7dd3b7dd3403f..fb07918ec5c3237a7a5386a7db175aa9b4d913f0 100644 (file)
@@ -1,6 +1,4 @@
 /*
-* $Id$
-*
  * ***** BEGIN GPL LICENSE BLOCK *****
  *
  * This program is free software; you can redistribute it and/or
@@ -25,8 +23,8 @@
  * Contributor(s): none yet.
  *
  * ***** END GPL LICENSE BLOCK *****
-* Start up of the Blender Player on GHOST.
-*/
+ * Start up of the Blender Player on GHOST.
+ */
 
 /** \file gameengine/GamePlayer/ghost/GPG_ghost.cpp
  *  \ingroup player
@@ -76,9 +74,6 @@ extern "C"
        
        int GHOST_HACK_getFirstFile(char buf[]);
        
-extern char bprogname[];       /* holds a copy of argv[0], from creator.c */
-extern char btempdir[];                /* use this to store a valid temp directory */
-
 // For BLF
 #include "BLF_api.h"
 #include "BLF_translation.h"
@@ -116,8 +111,6 @@ extern char datatoc_bfont_ttf[];
 const int kMinWindowWidth = 100;
 const int kMinWindowHeight = 100;
 
-char bprogname[FILE_MAX];
-
 static void mem_error_cb(const char *errorStr)
 {
        fprintf(stderr, "%s", errorStr);
@@ -309,7 +302,7 @@ static void get_filename(int argc, char **argv, char *filename)
 #endif // !_APPLE
 }
 
-static BlendFileData *load_game_data(char *progname, char *filename = NULL, char *relativename = NULL)
+static BlendFileData *load_game_data(const char *progname, char *filename = NULL, char *relativename = NULL)
 {
        ReportList reports;
        BlendFileData *bfd = NULL;
@@ -321,7 +314,7 @@ static BlendFileData *load_game_data(char *progname, char *filename = NULL, char
                bfd= BLO_read_runtime(progname, &reports);
                if (bfd) {
                        bfd->type= BLENFILETYPE_RUNTIME;
-                       strcpy(bfd->main->name, progname);
+                       BLI_strncpy(bfd->main->name, progname, sizeof(bfd->main->name));
                }
        } else {
                bfd= BLO_read_from_file(progname, &reports);
@@ -379,7 +372,8 @@ int main(int argc, char** argv)
        signal (SIGFPE, SIG_IGN);
 #endif /* __alpha__ */
 #endif /* __linux__ */
-       BLI_where_am_i(bprogname, sizeof(bprogname), argv[0]);
+       BLI_init_program_path(argv[0]);
+       BLI_init_temporary_dir(NULL);
 #ifdef __APPLE__
        // Can't use Carbon right now because of double defined type ID (In Carbon.h and DNA_ID.h, sigh)
        /*
@@ -766,7 +760,7 @@ int main(int argc, char** argv)
                                                char basedpath[240];
                                                
                                                // base the actuator filename relative to the last file
-                                               strcpy(basedpath, exitstring.Ptr());
+                                               BLI_strncpy(basedpath, exitstring.Ptr(), sizeof(basedpath));
                                                BLI_path_abs(basedpath, pathname);
                                                
                                                bfd = load_game_data(basedpath);
@@ -784,7 +778,7 @@ int main(int argc, char** argv)
                                        }
                                        else
                                        {
-                                               bfd = load_game_data(bprogname, filename[0]? filename: NULL);
+                                               bfd = load_game_data(BLI_program_path(), filename[0]? filename: NULL);
                                        }
                                        
                                        //::printf("game data loaded from %s\n", filename);