From 6bc080f51997cd842a4911969d976e555dde974e Mon Sep 17 00:00:00 2001 From: David Rose Date: Wed, 5 Nov 2003 00:48:28 +0000 Subject: [PATCH] run pview asynchronously on windows --- pandatool/src/mayaprogs/mayaSavePview.cxx | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/pandatool/src/mayaprogs/mayaSavePview.cxx b/pandatool/src/mayaprogs/mayaSavePview.cxx index 1de481310b..e05b895098 100644 --- a/pandatool/src/mayaprogs/mayaSavePview.cxx +++ b/pandatool/src/mayaprogs/mayaSavePview.cxx @@ -24,6 +24,10 @@ #include +#ifdef WIN32_VC +#include +#endif + //////////////////////////////////////////////////////////////////// // Function: MayaSavePview::Constructor // Access: Public @@ -49,12 +53,27 @@ doIt(const MArgList &) { } 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("\""); int command_result = system(command.asChar()); if (command_result != 0) { return MS::kFailure; } +#endif // WIN32_VC return MS::kSuccess; }