mirror of
https://github.com/panda3d/panda3d.git
synced 2025-10-04 19:08:55 -04:00
run pview asynchronously on windows
This commit is contained in:
parent
f4b1a218d6
commit
6bc080f519
@ -24,6 +24,10 @@
|
|||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#ifdef WIN32_VC
|
||||||
|
#include <process.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////
|
||||||
// Function: MayaSavePview::Constructor
|
// Function: MayaSavePview::Constructor
|
||||||
// Access: Public
|
// Access: Public
|
||||||
@ -49,12 +53,27 @@ doIt(const MArgList &) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
MString filename = MFileIO::currentFile();
|
MString filename = MFileIO::currentFile();
|
||||||
|
|
||||||
|
#ifdef WIN32_VC
|
||||||
|
// On Windows, we use the spawn function to run pview
|
||||||
|
// asynchronously.
|
||||||
|
int retval = _spawnlp(_P_DETACH, "pview",
|
||||||
|
"pview", "-cl", filename.asChar(), NULL);
|
||||||
|
if (retval == -1) {
|
||||||
|
return MS::kFailure;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else // WIN32_VC
|
||||||
|
// On non-Windows (e.g. Unix), we just use the system function,
|
||||||
|
// which runs synchronously. We could fork a process, but no one's
|
||||||
|
// asked for this yet.
|
||||||
MString command = MString("pview -c \"") + filename + MString("\"");
|
MString command = MString("pview -c \"") + filename + MString("\"");
|
||||||
|
|
||||||
int command_result = system(command.asChar());
|
int command_result = system(command.asChar());
|
||||||
if (command_result != 0) {
|
if (command_result != 0) {
|
||||||
return MS::kFailure;
|
return MS::kFailure;
|
||||||
}
|
}
|
||||||
|
#endif // WIN32_VC
|
||||||
|
|
||||||
return MS::kSuccess;
|
return MS::kSuccess;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user