mirror of
https://github.com/OpenTTD/OpenTTD
synced 2025-12-24 05:32:59 +01:00
(svn r8922) [0.5] -Backport from trunk (r8907, r8919, r8920, r8921):
- [OSX] Reading from an unitialized variable (r8907) - [Win9x] FindFile with C:\\* doesn't work, don't append a slash doubly (r8919) - Do not require to press 'Apply changes' in the newgrf GUI if the changes in there are not activated (this happens in the title screen) (r8920) - Possible crashes, problems with aircraft and airport removal (r8921)
This commit is contained in:
7
win32.c
7
win32.c
@@ -662,8 +662,11 @@ DIR *opendir(const wchar_t *path)
|
||||
d = dir_calloc();
|
||||
if (d != NULL) {
|
||||
wchar_t search_path[MAX_PATH];
|
||||
/* build search path for FindFirstFile */
|
||||
_snwprintf(search_path, lengthof(search_path), L"%s\\*", path);
|
||||
bool slash = path[wcslen(path) - 1] == L'\\';
|
||||
|
||||
/* build search path for FindFirstFile, try not to append additional slashes
|
||||
* as it throws Win9x off its groove for root directories */
|
||||
_snwprintf(search_path, lengthof(search_path), L"%s%s*", path, slash ? L"" : L"\\");
|
||||
*lastof(search_path) = '\0';
|
||||
d->hFind = FindFirstFileW(search_path, &d->fd);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user