mirror of
https://github.com/OpenTTD/OpenTTD.git
synced 2025-03-06 14:27:16 +00:00
(svn r25974) -Codechange: make the _personal_dir global const, since once it's set it shouldn't be changed anyhow
This commit is contained in:
parent
63e0ff048e
commit
def597fe31
@ -1143,7 +1143,7 @@ extern void cocoaSetApplicationBundleDir();
|
|||||||
}
|
}
|
||||||
#endif /* defined(WIN32) || defined(WINCE) */
|
#endif /* defined(WIN32) || defined(WINCE) */
|
||||||
|
|
||||||
char *_personal_dir;
|
const char *_personal_dir;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Acquire the base paths (personal dir and game data dir),
|
* Acquire the base paths (personal dir and game data dir),
|
||||||
@ -1162,13 +1162,14 @@ void DeterminePaths(const char *exe)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (_config_file != NULL) {
|
if (_config_file != NULL) {
|
||||||
_personal_dir = strdup(_config_file);
|
char *dir = strdup(_config_file);
|
||||||
char *end = strrchr(_personal_dir, PATHSEPCHAR);
|
char *end = strrchr(dir, PATHSEPCHAR);
|
||||||
if (end == NULL) {
|
if (end == NULL) {
|
||||||
_personal_dir[0] = '\0';
|
dir[0] = '\0';
|
||||||
} else {
|
} else {
|
||||||
end[1] = '\0';
|
end[1] = '\0';
|
||||||
}
|
}
|
||||||
|
_personal_dir = dir;
|
||||||
} else {
|
} else {
|
||||||
char personal_dir[MAX_PATH];
|
char personal_dir[MAX_PATH];
|
||||||
if (FioFindFullPath(personal_dir, lengthof(personal_dir), BASE_DIR, "openttd.cfg") != NULL) {
|
if (FioFindFullPath(personal_dir, lengthof(personal_dir), BASE_DIR, "openttd.cfg") != NULL) {
|
||||||
@ -1195,9 +1196,9 @@ void DeterminePaths(const char *exe)
|
|||||||
|
|
||||||
_highscore_file = str_fmt("%shs.dat", _personal_dir);
|
_highscore_file = str_fmt("%shs.dat", _personal_dir);
|
||||||
extern char *_hotkeys_file;
|
extern char *_hotkeys_file;
|
||||||
_hotkeys_file = str_fmt("%shotkeys.cfg", _personal_dir);
|
_hotkeys_file = str_fmt("%shotkeys.cfg", _personal_dir);
|
||||||
extern char *_windows_file;
|
extern char *_windows_file;
|
||||||
_windows_file = str_fmt("%swindows.cfg", _personal_dir);
|
_windows_file = str_fmt("%swindows.cfg", _personal_dir);
|
||||||
|
|
||||||
/* Make the necessary folders */
|
/* Make the necessary folders */
|
||||||
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && defined(WITH_PERSONAL_DIR)
|
#if !defined(__MORPHOS__) && !defined(__AMIGA__) && defined(WITH_PERSONAL_DIR)
|
||||||
|
@ -67,7 +67,7 @@ const char *FioTarFirstDir(const char *tarname, Subdirectory subdir);
|
|||||||
void FioTarAddLink(const char *src, const char *dest, Subdirectory subdir);
|
void FioTarAddLink(const char *src, const char *dest, Subdirectory subdir);
|
||||||
bool ExtractTar(const char *tar_filename, Subdirectory subdir);
|
bool ExtractTar(const char *tar_filename, Subdirectory subdir);
|
||||||
|
|
||||||
extern char *_personal_dir; ///< custom directory for personal settings, saves, newgrf, etc.
|
extern const char *_personal_dir; ///< custom directory for personal settings, saves, newgrf, etc.
|
||||||
|
|
||||||
/** Helper for scanning for files with a given name */
|
/** Helper for scanning for files with a given name */
|
||||||
class FileScanner {
|
class FileScanner {
|
||||||
|
Loading…
Reference in New Issue
Block a user