ENH: Start working on Working Directory support

This commit is contained in:
Andy Cedilnik
2003-07-07 08:36:40 -04:00
parent 179abe7ffe
commit 125b795637
2 changed files with 34 additions and 0 deletions
+26
View File
@@ -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;
@@ -206,6 +209,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)
{