mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-02 12:19:54 -05:00
ENH: Start working on Working Directory support
This commit is contained in:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user