[ #4786 ] if space in the Application path name, system() doesn't work on some platforms
authorAndrea Weikert <elubie@gmx.net>
Sat, 20 Jan 2007 08:01:56 +0000 (08:01 +0000)
committerAndrea Weikert <elubie@gmx.net>
Sat, 20 Jan 2007 08:01:56 +0000 (08:01 +0000)
commited temporary fix: executable name is quoted for all platforms except Windows now,
nicely wrapped in #ifdefs. Will be doing nice wrapper function BLI_system for system calls in blenlib
after release.
Please test on all platforms!

source/blender/python/api2_2x/sceneRender.c
source/blender/src/buttons_scene.c
source/blender/src/editimasel.c
source/blender/src/filesel.c

index 0016f983189595771411306372cad38bd9d25b16..3986df44e523a7ca8bd44c3e6d0cb04afdf0d719 100644 (file)
@@ -508,8 +508,13 @@ PyObject *RenderData_Play( BPy_RenderData * self )
                BKE_makepicstring( file, G.scene->r.pic, self->renderContext->sfra, G.scene->r.imtype);
                if( BLI_exist( file ) ) {
                        calc_renderwin_rectangle(640, 480, G.winpos, pos, size);
+#ifdef WIN32
                        sprintf( str, "%s -a -p %d %d \"%s\"", bprogname,
                                 pos[0], pos[1], file );
+#else
+                       sprintf( str, "\"%s\" -a -p %d %d \"%s\"", bprogname,
+                                pos[0], pos[1], file );
+#endif
                        system( str );
                } else
                        sprintf( "Can't find image: %s", file );
index 0ab4b4b75f939cff6c73c83ad80b85bf08bff7b4..1711ec7d4fb921e1c87fadc73525c0c21775c090 100644 (file)
@@ -505,8 +505,11 @@ static void run_playanim(char *file)
        /* use current settings for defining position of window. it actually should test image size */
        calc_renderwin_rectangle((G.scene->r.xsch*G.scene->r.size)/100, 
                                                         (G.scene->r.ysch*G.scene->r.size)/100, G.winpos, pos, size);
-
+#ifdef WIN32
        sprintf(str, "%s -a -p %d %d \"%s\"", bprogname, pos[0], pos[1], file);
+#else
+       sprintf(str, "\"%s\" -a -p %d %d \"%s\"", bprogname, pos[0], pos[1], file);
+#endif
        system(str);
 }
 
index 3d2b3c8b715ea6aac3b6bb4b52ced03221370cdd..f3f9aa31d07abe2431c2fae045da080d92631dfa 100644 (file)
@@ -340,8 +340,11 @@ void winqreadimaselspace(ScrArea *sa, void *spacedata, BWinEvent *evt)
        case PKEY:
                if(G.qual & LR_SHIFTKEY) {
                        extern char bprogname[];        /* usiblender.c */
-                       
+#ifdef WIN32                   
                        sprintf(name, "%s -a \"%s%s\"", bprogname, simasel->dir, simasel->file);
+#else
+                       sprintf(name, "\"%s\" -a \"%s%s\"", bprogname, simasel->dir, simasel->file);
+#endif
                        system(name);
                }
                if(G.qual & LR_CTRLKEY) {
index 10af190c4dc81f783af911386298bb256e813351..760e200ee269f619d00b8dd73a5845ef851317ca 100644 (file)
@@ -2222,8 +2222,11 @@ void winqreadfilespace(ScrArea *sa, void *spacedata, BWinEvent *evt)
                case PKEY:
                        if(G.qual & LR_SHIFTKEY) {
                                extern char bprogname[];        /* usiblender.c */
-                       
+#ifdef WIN32                   
                                sprintf(str, "%s -a \"%s%s\"", bprogname, sfile->dir, sfile->file);
+#else
+                               sprintf(str, "\"%s\" -a \"%s%s\"", bprogname, sfile->dir, sfile->file);
+#endif
                                system(str);
                        }
                        else