[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [15313] branches/apricot/source/blender/ python/BPY_interface.c: * 22:51 < ideasman-42> jesterKing, dude you totally over did it :0
Nathan Letwory
jesterking at letwory.net
Sun Jun 22 22:24:40 CEST 2008
Revision: 15313
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=15313
Author: jesterking
Date: 2008-06-22 22:24:27 +0200 (Sun, 22 Jun 2008)
Log Message:
-----------
* 22:51 < ideasman-42> jesterKing, dude you totally over did it :0
- the solution was longer than needed. A simple letter addition (r) would've been enough.
Modified Paths:
--------------
branches/apricot/source/blender/python/BPY_interface.c
Modified: branches/apricot/source/blender/python/BPY_interface.c
===================================================================
--- branches/apricot/source/blender/python/BPY_interface.c 2008-06-22 19:49:48 UTC (rev 15312)
+++ branches/apricot/source/blender/python/BPY_interface.c 2008-06-22 20:24:27 UTC (rev 15313)
@@ -782,40 +782,6 @@
}
}
-#ifdef WIN32
-static char *escape_slashes(const char *s) {
- int l= 0;
- int i= 0;
- int k= 0;
- char *news= NULL;
- char *tmp= (char *)s;
- int slashcount= 0;
- if(s==0) return 0;
- l= strlen(s);
- for(i= 0; i < l; i++) {
- if(tmp[i]=='\\')
- slashcount++;
- }
-
- if(slashcount>0) {
- news= MEM_mallocN(slashcount+l+1, "escslashes");
- tmp= (char *)s;
- for(i= 0; i < l; i++) {
- if(tmp[i]=='\\') {
- news[i+k]='\\';
- k++;
- }
- news[i+k]= tmp[i];
- }
- news[slashcount+l] = '\0';
- } else {
- news= (char *)s;
- }
-
- return news;
-}
-#endif
-
int BPY_run_script(Script *script)
{
PyObject *py_dict, *py_res, *pyarg;
@@ -911,21 +877,10 @@
if (text) {
py_res = RunPython( text, py_dict );
} else {
-#ifdef WIN32
- /* backward slashes need to be escaped on windows, otherwise execfile() doesn't work right */
- char *scriptname= escape_slashes(script->scriptname);
- char pystring[sizeof(scriptname) + 14];
+ char pystring[sizeof(script->scriptname) + 15];
pystring[0] = '\0';
- sprintf(pystring, "execfile('%s')", scriptname);
-#else
- char pystring[sizeof(script->scriptname) + 14];
- pystring[0] = '\0';
- sprintf(pystring, "execfile('%s')", script->scriptname);
-#endif
+ sprintf(pystring, "execfile(r'%s')", script->scriptname);
py_res = PyRun_String( pystring, Py_file_input, py_dict, py_dict );
-#ifdef WIN32
- MEM_freeN(scriptname);
-#endif
}
if( !py_res ) { /* Failed execution of the script */
More information about the Bf-blender-cvs
mailing list