diff options
author | Darkvater <Darkvater@openttd.org> | 2007-02-20 00:09:23 +0000 |
---|---|---|
committer | Darkvater <Darkvater@openttd.org> | 2007-02-20 00:09:23 +0000 |
commit | 7eab669a888fa61f916b4617315eff6a53c712ff (patch) | |
tree | 2597b59d39104907743caf0340df546274f0b559 /src/fios.h | |
parent | 37f14d44441708e11ac1d629221ba147174569c0 (diff) | |
download | openttd-7eab669a888fa61f916b4617315eff6a53c712ff.tar.xz |
(svn r8821) -Regression: Unable to browse directories on *nix if the filesystem is not in UTF-8 charset and special characters are used. The string passed to opendir() which is UTF-8 was not parsed back to the filesystem format. Use a wrapper called ttd_opendir() instead of redefining opendir itself.
Diffstat (limited to 'src/fios.h')
-rw-r--r-- | src/fios.h | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/fios.h b/src/fios.h index 85d0b6041..0663b781b 100644 --- a/src/fios.h +++ b/src/fios.h @@ -77,10 +77,21 @@ struct DIR { bool at_first_entry; }; -DIR *opendir(const char *path); +DIR *opendir(const wchar_t *path); struct dirent *readdir(DIR *d); int closedir(DIR *d); - #endif /* defined(WIN32) */ +/** + * A wrapper around opendir() which will convert the string from + * OPENTTD encoding to that of the filesystem. For all purposes this + * function behaves the same as the original opendir function + * @param path string to open directory of + * @return DIR pointer + */ +static inline DIR *ttd_opendir(const char *path) +{ + return opendir(OTTD2FS(path)); +} + #endif /* FIOS_H */ |