summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-03-04 14:25:53 +0000
committerrubidium <rubidium@openttd.org>2009-03-04 14:25:53 +0000
commit013e354c47798632d66428b212a6f5837bcb0464 (patch)
tree2d9370d65b75cd16f77704535b7ddee0121cab3e /src
parentf16f7e2c928c96cb90c62905cfadc889aeac083e (diff)
downloadopenttd-013e354c47798632d66428b212a6f5837bcb0464.tar.xz
(svn r15612) -Codechange: unduplicate directory creation
Diffstat (limited to 'src')
-rw-r--r--src/fileio.cpp15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/fileio.cpp b/src/fileio.cpp
index 3ad29b6f2..2c177f648 100644
--- a/src/fileio.cpp
+++ b/src/fileio.cpp
@@ -935,19 +935,20 @@ void DeterminePaths(const char *exe)
_highscore_file = str_fmt("%shs.dat", _personal_dir);
_log_file = str_fmt("%sopenttd.log", _personal_dir);
- char *save_dir = str_fmt("%s%s", _personal_dir, FioGetSubdirectory(SAVE_DIR));
- char *autosave_dir = str_fmt("%s%s", _personal_dir, FioGetSubdirectory(AUTOSAVE_DIR));
-
/* Make the necessary folders */
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && defined(WITH_PERSONAL_DIR)
FioCreateDirectory(_personal_dir);
#endif
- FioCreateDirectory(save_dir);
- FioCreateDirectory(autosave_dir);
+ static const Subdirectory default_subdirs[] = {
+ SAVE_DIR, AUTOSAVE_DIR
+ };
- free(save_dir);
- free(autosave_dir);
+ for (uint i = 0; i < lengthof(default_subdirs); i++) {
+ char *dir = str_fmt("%s%s", _personal_dir, FioGetSubdirectory(default_subdirs[i]));
+ FioCreateDirectory(dir);
+ free(dir);
+ }
/* If we have network we make a directory for the autodownloading of content */
_searchpaths[SP_AUTODOWNLOAD_DIR] = str_fmt("%s%s", _personal_dir, "content_download" PATHSEP);