diff options
author | Michael Lutz <michi@icosahedron.de> | 2020-12-06 21:11:42 +0100 |
---|---|---|
committer | Michael Lutz <michi@icosahedron.de> | 2020-12-27 13:19:25 +0100 |
commit | dd138fc460dcbab37452e90ff070a31516994aa2 (patch) | |
tree | 170edd04094e997abe891858a8e4753071983fee /src/ini.cpp | |
parent | 860c270c73048b4930ac8cbebcd60be746eb9782 (diff) | |
download | openttd-dd138fc460dcbab37452e90ff070a31516994aa2.tar.xz |
Codechange: Stringify config file paths.
Diffstat (limited to 'src/ini.cpp')
-rw-r--r-- | src/ini.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/ini.cpp b/src/ini.cpp index fc9b1e8fd..036ced668 100644 --- a/src/ini.cpp +++ b/src/ini.cpp @@ -43,7 +43,7 @@ IniFile::IniFile(const char * const *list_group_names) : IniLoadFile(list_group_ * @param filename the file to save to. * @return true if saving succeeded. */ -bool IniFile::SaveToDisk(const char *filename) +bool IniFile::SaveToDisk(const std::string &filename) { /* * First write the configuration to a (temporary) file and then rename @@ -96,7 +96,7 @@ bool IniFile::SaveToDisk(const char *filename) # undef strncpy /* Allocate space for one more \0 character. */ TCHAR tfilename[MAX_PATH + 1], tfile_new[MAX_PATH + 1]; - _tcsncpy(tfilename, OTTD2FS(filename), MAX_PATH); + _tcsncpy(tfilename, OTTD2FS(filename.c_str()), MAX_PATH); _tcsncpy(tfile_new, OTTD2FS(file_new.c_str()), MAX_PATH); /* SHFileOperation wants a double '\0' terminated string. */ tfilename[MAX_PATH - 1] = '\0'; @@ -113,8 +113,8 @@ bool IniFile::SaveToDisk(const char *filename) shfopt.pTo = tfilename; SHFileOperation(&shfopt); #else - if (rename(file_new.c_str(), filename) < 0) { - DEBUG(misc, 0, "Renaming %s to %s failed; configuration not saved", file_new.c_str(), filename); + if (rename(file_new.c_str(), filename.c_str()) < 0) { + DEBUG(misc, 0, "Renaming %s to %s failed; configuration not saved", file_new.c_str(), filename.c_str()); } #endif |