Fix compilation on Windows after f30434ac99.
This commit is contained in:
parent
88ace032a6
commit
8775cf804e
@ -1137,7 +1137,7 @@ bool BLI_path_abs_from_cwd(char *path, const size_t maxlen)
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
/**
|
/**
|
||||||
* Tries appending each of the semicolon-separated extensions in the `PATHEXT`
|
* Tries appending each of the semicolon-separated extensions in the `PATHEXT`
|
||||||
* environment variable (Windows-only) onto `name` in turn until such a file is found.
|
* environment variable (Windows-only) onto `program_name` in turn until such a file is found.
|
||||||
* Returns success/failure.
|
* Returns success/failure.
|
||||||
*/
|
*/
|
||||||
bool BLI_path_program_extensions_add_win32(char *program_name, const size_t maxlen)
|
bool BLI_path_program_extensions_add_win32(char *program_name, const size_t maxlen)
|
||||||
@ -1145,19 +1145,19 @@ bool BLI_path_program_extensions_add_win32(char *program_name, const size_t maxl
|
|||||||
bool retval = false;
|
bool retval = false;
|
||||||
int type;
|
int type;
|
||||||
|
|
||||||
type = BLI_exists(name);
|
type = BLI_exists(program_name);
|
||||||
if ((type == 0) || S_ISDIR(type)) {
|
if ((type == 0) || S_ISDIR(type)) {
|
||||||
/* Typically 3-5, ".EXE", ".BAT"... etc. */
|
/* Typically 3-5, ".EXE", ".BAT"... etc. */
|
||||||
const int ext_max = 12;
|
const int ext_max = 12;
|
||||||
const char *ext = BLI_getenv("PATHEXT");
|
const char *ext = BLI_getenv("PATHEXT");
|
||||||
if (ext) {
|
if (ext) {
|
||||||
const int name_len = strlen(name);
|
const int name_len = strlen(program_name);
|
||||||
char *filename = alloca(name_len + ext_max);
|
char *filename = alloca(name_len + ext_max);
|
||||||
char *filename_ext;
|
char *filename_ext;
|
||||||
const char *ext_next;
|
const char *ext_next;
|
||||||
|
|
||||||
/* Null terminated in the loop. */
|
/* Null terminated in the loop. */
|
||||||
memcpy(filename, name, name_len);
|
memcpy(filename, program_name, name_len);
|
||||||
filename_ext = filename + name_len;
|
filename_ext = filename + name_len;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
@ -1172,7 +1172,7 @@ bool BLI_path_program_extensions_add_win32(char *program_name, const size_t maxl
|
|||||||
type = BLI_exists(filename);
|
type = BLI_exists(filename);
|
||||||
if (type && (!S_ISDIR(type))) {
|
if (type && (!S_ISDIR(type))) {
|
||||||
retval = true;
|
retval = true;
|
||||||
BLI_strncpy(name, filename, maxlen);
|
BLI_strncpy(program_name, filename, maxlen);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user