[ #4786 ] if space in the Application path name, system() doesn't work on some platforms

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!
This commit is contained in:
Andrea Weikert
2007-01-20 08:01:56 +00:00
parent 783a2900a6
commit 38375784df
4 changed files with 17 additions and 3 deletions

View 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 );

View 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);
}

View 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) {

View 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