MCPcopy Create free account
hub / github.com/Kitware/CMake / kwsysProcess_SetWorkingDirectory

Function kwsysProcess_SetWorkingDirectory

Source/kwsys/ProcessWin32.c:657–686  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

655}
656
657int kwsysProcess_SetWorkingDirectory(kwsysProcess* cp, char const* dir)
658{
659 if (!cp) {
660 return 0;
661 }
662 if (cp->WorkingDirectory) {
663 free(cp->WorkingDirectory);
664 cp->WorkingDirectory = 0;
665 }
666 if (dir && dir[0]) {
667 wchar_t* wdir = kwsysEncoding_DupToWide(dir);
668 /* We must convert the working directory to a full path. */
669 DWORD length = GetFullPathNameW(wdir, 0, NULL, NULL);
670 if (length > 0) {
671 wchar_t* work_dir = malloc(length * sizeof(wchar_t));
672 if (!work_dir) {
673 free(wdir);
674 return 0;
675 }
676 if (!GetFullPathNameW(wdir, length, work_dir, NULL)) {
677 free(work_dir);
678 free(wdir);
679 return 0;
680 }
681 cp->WorkingDirectory = work_dir;
682 }
683 free(wdir);
684 }
685 return 1;
686}
687
688int kwsysProcess_SetPipeFile(kwsysProcess* cp, int pipe, char const* file)
689{

Callers 1

kwsysProcess_DeleteFunction · 0.70

Calls 1

kwsysEncoding_DupToWideFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…