/* The Microsoft _spawnv() does not allow to run scripts. But * this is essential to get scripting extension up and running. * Following the replacement function xspawnv(). */ gint xspawnv (gint mode, const gchar *cmdname, const gchar *const *argv) { gchar sExecutable[_MAX_PATH*2]; gchar** sArgsList; gchar sCmndLine[1024]; gchar* sPath; HINSTANCE hInst; gint i; gint pid; /* only use it if _spawnv fails */ pid = _spawnv (mode, cmdname, argv); if (pid != -1) return pid; /* stuff parameters into one cmndline */ sCmndLine[0] = 0; for (i = 1; argv[i] != NULL; i++) { strcat (sCmndLine, argv[i]); strcat (sCmndLine, " "); } /* remove last blank */ sCmndLine[strlen (sCmndLine)-1] = 0; /* do we really need _spawnv (ShelExecute seems not to do it)*/ if (32 <= (int) FindExecutable (cmdname, gimp_directory (), sExecutable)) { /* g_print("_spawnlp %s %s %s", sExecutable, cmdname, sCmndLine); */ pid = _spawnlp (mode, sExecutable, "-c", cmdname, sCmndLine, NULL); } else { g_warning ("Execution error for: %s", cmdname); return -1; } return pid; }