summaryrefslogtreecommitdiffstats
path: root/Source/kwsys/ProcessUNIX.c
diff options
context:
space:
mode:
authorAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-07 12:36:40 (GMT)
committerAndy Cedilnik <andy.cedilnik@kitware.com>2003-07-07 12:36:40 (GMT)
commit125b7956378ef65bfbd23751054decfa44169db9 (patch)
treebb52976a6a79afd86aa9c980295c1f360b3b2a8c /Source/kwsys/ProcessUNIX.c
parent179abe7ffeb125ef4bfa7c852dfad03544d66194 (diff)
downloadCMake-125b7956378ef65bfbd23751054decfa44169db9.zip
CMake-125b7956378ef65bfbd23751054decfa44169db9.tar.gz
CMake-125b7956378ef65bfbd23751054decfa44169db9.tar.bz2
ENH: Start working on Working Directory support
Diffstat (limited to 'Source/kwsys/ProcessUNIX.c')
-rw-r--r--Source/kwsys/ProcessUNIX.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index fc315a9..96b8300 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -99,6 +99,9 @@ struct kwsysProcess_s
/* The timeout length. */
double Timeout;
+
+ /* The working directory for the process. */
+ char* WorkingDirectory;
/* Time at which the child started. Negative for no timeout. */
kwsysProcessTime StartTime;
@@ -207,6 +210,29 @@ void kwsysProcess_SetTimeout(kwsysProcess* cp, double timeout)
}
/*--------------------------------------------------------------------------*/
+void kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, const char* dir)
+{
+ if(cp->WorkingDirectory == dir)
+ {
+ return;
+ }
+ if(cp->WorkingDirectory && dir && strcmp(cp->WorkingDirectory, dir) == 0)
+ {
+ return;
+ }
+ if(cp->WorkingDirectory)
+ {
+ free(cp->WorkingDirectory);
+ cp->WorkingDirectory = 0;
+ }
+ if(dir)
+ {
+ cp->WorkingDirectory = (char*) malloc(strlen(dir) + 1);
+ strcpy(cp->WorkingDirectory, dir);
+ }
+}
+
+/*--------------------------------------------------------------------------*/
int kwsysProcess_GetState(kwsysProcess* cp)
{
return cp->State;