Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
windows: remove quotes from PATH in uv_spawn
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Zinkovsky committed Nov 4, 2011
1 parent fe97c4d commit 82cf0b3
Showing 1 changed file with 17 additions and 3 deletions.
20 changes: 17 additions & 3 deletions src/win/process.c
Expand Up @@ -268,6 +268,8 @@ static wchar_t* search_path(const wchar_t *file,
wchar_t* result = NULL;
wchar_t *file_name_start;
wchar_t *dot;
const wchar_t *dir_start, *dir_end, *dir_path;
int dir_len;
int name_has_ext;

int file_len = wcslen(file);
Expand Down Expand Up @@ -305,8 +307,7 @@ static wchar_t* search_path(const wchar_t *file,
name_has_ext);

} else {
const wchar_t *dir_start,
*dir_end = path;
dir_end = path;

/* The file is really only a name; look in cwd first, then scan path */
result = path_search_walk_ext(L"", 0,
Expand Down Expand Up @@ -338,7 +339,20 @@ static wchar_t* search_path(const wchar_t *file,
continue;
}

result = path_search_walk_ext(dir_start, dir_end - dir_start,
dir_path = dir_start;
dir_len = dir_end - dir_start;

/* Adjust if the path is quoted. */
if (dir_path[0] == '"' || dir_path[0] == '\'') {
++dir_path;
--dir_len;
}

if (dir_path[dir_len - 1] == '"' || dir_path[dir_len - 1] == '\'') {
--dir_len;
}

result = path_search_walk_ext(dir_path, dir_len,
file, file_len,
cwd, cwd_len,
name_has_ext);
Expand Down

0 comments on commit 82cf0b3

Please sign in to comment.