Contains some generally useful functions for launching applications.
|
static int | appPath (char *pBuf, size_t len, bool clipFilename) |
| Returns the full name (including path) of the executing application. Returns the length of the returned string, or -1 if it failed. If clipFilename is true, it will omit the filename and just return the folder in which the application resides. More...
|
|
static void | enableFloatingPointExceptions () |
| If you're having trouble with bogus floating point values (like NAN or INF), this method will cause an exception to be thrown when overflow, divide-by-zero, or a NAN condition occurs. More...
|
|
static void | launchDaemon (DaemonMainFunc pDaemonMain, void *pArg, const char *stdoutFilename=NULL, const char *stderrFilename=NULL) |
| Launches a daemon process that calls pDaemonMain, and then exits. Throws an exception if any error occurs while launching the daemon. if stdoutFilename and/or stderrFilename is non-NULL, then the corresponding stream will be redirected to append to the specified file. (On Windows, this method just calls pDaemonMain normally, and does not fork off a separate process.) More...
|
|
static bool | openUrlInBrowser (const char *szUrl) |
| Opens the specified URL in the default web browser. Returns true if successful, and false if not. More...
|
|
static int | systemCall (const char *szCommand, bool wait, bool show) |
| Executes the specified system command. Output is directed to the console. (If you want to hide the output or direct it to a file, use systemExec.) The child app runs inside a security sandbox (at least on Windows, I'm not totally sure about Linux), so you can't necessarily access everything the parent process could access. Throws if there is an error executing the command. Otherwise, returns the exit code of the child process. "show" does nothing on Linux. More...
|
|
static int | systemExecute (const char *szCommand, bool wait, GPipe *pStdOut=NULL, GPipe *pStdErr=NULL, GPipe *pStdIn=NULL) |
| Executes the specified system command. (szCommand should contain the app name as well as args.) If wait is true, then the exit code of the command will be returned. If wait is false, then the process id will be returned immediately, and the command will continue to execute. If pStdOut is NULL, it will use the same stdout as the calling process. If pStdOut is non-NULL, then the value it points to will be set to the handle of the read end of a pipe, which will receive the stdout output of the called process. Likewise with pStdErr. If pStdIn is non-NULL, then it should point to the read end of a pipe, and it will be used for stdin with the called process. More...
|
|
static int GClasses::GApp::systemExecute |
( |
const char * |
szCommand, |
|
|
bool |
wait, |
|
|
GPipe * |
pStdOut = NULL , |
|
|
GPipe * |
pStdErr = NULL , |
|
|
GPipe * |
pStdIn = NULL |
|
) |
| |
|
static |
Executes the specified system command. (szCommand should contain the app name as well as args.) If wait is true, then the exit code of the command will be returned. If wait is false, then the process id will be returned immediately, and the command will continue to execute. If pStdOut is NULL, it will use the same stdout as the calling process. If pStdOut is non-NULL, then the value it points to will be set to the handle of the read end of a pipe, which will receive the stdout output of the called process. Likewise with pStdErr. If pStdIn is non-NULL, then it should point to the read end of a pipe, and it will be used for stdin with the called process.