Changeset - r5296:9e88faa6d573
[Not reviewed]
master
0 17 0
Darkvater - 18 years ago 2006-12-09 10:56:12
darkvater@openttd.org
(svn r7449) -Codechange: Rename _path to _paths as it is technically more correct, but mainly because
it interferes with OS/2 symbol in libc (psmedley)
17 files changed with 105 insertions and 105 deletions:
0 comments (0 inline, 0 general)
console_cmds.c
Show inline comments
 
@@ -187,7 +187,7 @@ DEF_CONSOLE_CMD(ConSave)
 
	if (argc == 2) {
 
		char buf[200];
 

	
 
		snprintf(buf, lengthof(buf), "%s%s%s.sav", _path.save_dir, PATHSEP, argv[1]);
 
		snprintf(buf, lengthof(buf), "%s%s%s.sav", _paths.save_dir, PATHSEP, argv[1]);
 
		IConsolePrint(_icolour_def, "Saving map...");
 

	
 
		if (SaveOrLoad(buf, SL_SAVE) != SL_OK) {
fileio.c
Show inline comments
 
@@ -117,19 +117,19 @@ FILE *FioFOpenFile(const char *filename)
 
	FILE *f;
 
	char buf[MAX_PATH];
 

	
 
	snprintf(buf, lengthof(buf), "%s%s", _path.data_dir, filename);
 
	snprintf(buf, lengthof(buf), "%s%s", _paths.data_dir, filename);
 

	
 
	f = fopen(buf, "rb");
 
#if !defined(WIN32)
 
	if (f == NULL) {
 
		strtolower(buf + strlen(_path.data_dir) - 1);
 
		strtolower(buf + strlen(_paths.data_dir) - 1);
 
		f = fopen(buf, "rb");
 

	
 
#if defined SECOND_DATA_DIR
 
		// tries in the 2nd data directory
 
		if (f == NULL) {
 
			snprintf(buf, lengthof(buf), "%s%s", _path.second_data_dir, filename);
 
			strtolower(buf + strlen(_path.second_data_dir) - 1);
 
			snprintf(buf, lengthof(buf), "%s%s", _paths.second_data_dir, filename);
 
			strtolower(buf + strlen(_paths.second_data_dir) - 1);
 
			f = fopen(buf, "rb");
 
		}
 
#endif
 
@@ -143,7 +143,7 @@ void FioOpenFile(int slot, const char *f
 
{
 
	FILE *f = FioFOpenFile(filename);
 

	
 
	if (f == NULL) error("Cannot open file '%s%s'", _path.data_dir, filename);
 
	if (f == NULL) error("Cannot open file '%s%s'", _paths.data_dir, filename);
 

	
 
	FioCloseFile(slot); // if file was opened before, close it
 
	_fio.handles[slot] = f;
fios.c
Show inline comments
 
@@ -324,7 +324,7 @@ FiosItem *FiosGetSavegameList(int mode)
 

	
 
	if (_fios_save_path == NULL) {
 
		_fios_save_path = malloc(MAX_PATH);
 
		ttd_strlcpy(_fios_save_path, _path.save_dir, MAX_PATH);
 
		ttd_strlcpy(_fios_save_path, _paths.save_dir, MAX_PATH);
 
	}
 

	
 
	_fios_path = _fios_save_path;
 
@@ -372,7 +372,7 @@ FiosItem *FiosGetScenarioList(int mode)
 

	
 
	if (_fios_scn_path == NULL) {
 
		_fios_scn_path = malloc(MAX_PATH);
 
		ttd_strlcpy(_fios_scn_path, _path.scenario_dir, MAX_PATH);
 
		ttd_strlcpy(_fios_scn_path, _paths.scenario_dir, MAX_PATH);
 
	}
 

	
 
	_fios_path = _fios_scn_path;
 
@@ -403,7 +403,7 @@ FiosItem *FiosGetHeightmapList(int mode)
 

	
 
	if (_fios_hmap_path == NULL) {
 
		_fios_hmap_path = malloc(MAX_PATH);
 
		strcpy(_fios_hmap_path, _path.heightmap_dir);
 
		strcpy(_fios_hmap_path, _paths.heightmap_dir);
 
	}
 

	
 
	_fios_path = _fios_hmap_path;
gfxinit.c
Show inline comments
 
@@ -111,12 +111,12 @@ static bool FileMD5(const MD5File file, 
 
	char buf[MAX_PATH];
 

	
 
	// open file
 
	snprintf(buf, lengthof(buf), "%s%s", _path.data_dir, file.filename);
 
	snprintf(buf, lengthof(buf), "%s%s", _paths.data_dir, file.filename);
 
	f = fopen(buf, "rb");
 

	
 
#if !defined(WIN32)
 
	if (f == NULL) {
 
		strtolower(buf + strlen(_path.data_dir) - 1);
 
		strtolower(buf + strlen(_paths.data_dir) - 1);
 
		f = fopen(buf, "rb");
 
	}
 
#endif
misc_gui.c
Show inline comments
 
@@ -1346,20 +1346,20 @@ static void SaveLoadDlgWndProc(Window *w
 
		switch (_saveload_mode) {
 
			case SLD_SAVE_GAME:
 
			case SLD_LOAD_GAME:
 
				ttd_strlcpy(&o_dir.name[0], _path.save_dir, sizeof(o_dir.name));
 
				ttd_strlcpy(&o_dir.name[0], _paths.save_dir, sizeof(o_dir.name));
 
				break;
 

	
 
			case SLD_SAVE_SCENARIO:
 
			case SLD_LOAD_SCENARIO:
 
				ttd_strlcpy(&o_dir.name[0], _path.scenario_dir, sizeof(o_dir.name));
 
				ttd_strlcpy(&o_dir.name[0], _paths.scenario_dir, sizeof(o_dir.name));
 
				break;
 

	
 
			case SLD_LOAD_HEIGHTMAP:
 
				ttd_strlcpy(&o_dir.name[0], _path.heightmap_dir, sizeof(o_dir.name));
 
				ttd_strlcpy(&o_dir.name[0], _paths.heightmap_dir, sizeof(o_dir.name));
 
				break;
 

	
 
			default:
 
				ttd_strlcpy(&o_dir.name[0], _path.personal_dir, sizeof(o_dir.name));
 
				ttd_strlcpy(&o_dir.name[0], _paths.personal_dir, sizeof(o_dir.name));
 
		}
 
		break;
 
		}
music_gui.c
Show inline comments
 
@@ -90,7 +90,7 @@ static void DoPlaySong(void)
 
{
 
	char filename[256];
 
	snprintf(filename, sizeof(filename), "%s%s",
 
		_path.gm_dir, origin_songs_specs[_music_wnd_cursong - 1].filename);
 
		_paths.gm_dir, origin_songs_specs[_music_wnd_cursong - 1].filename);
 
	_music_driver->play_song(filename);
 
}
 

	
 
@@ -109,7 +109,7 @@ static void SelectSongToPlay(void)
 
	do {
 
		if (_playlists[msf.playlist][i] != 0) {  // Don't evaluate playlist terminator
 
			snprintf(filename, sizeof(filename),  "%s%s",
 
				_path.gm_dir, origin_songs_specs[(_playlists[msf.playlist][i]) - 1].filename);
 
				_paths.gm_dir, origin_songs_specs[(_playlists[msf.playlist][i]) - 1].filename);
 

	
 
			/* we are now checking for the existence of that file prior
 
			 * to add it to the list of available songs */
network_client.c
Show inline comments
 
@@ -457,7 +457,7 @@ DEF_CLIENT_RECEIVE_COMMAND(PACKET_SERVER
 
	// First packet, init some stuff
 
	if (maptype == MAP_PACKET_START) {
 
		// The name for the temp-map
 
		snprintf(filename, lengthof(filename), "%s%snetwork_client.tmp",  _path.autosave_dir, PATHSEP);
 
		snprintf(filename, lengthof(filename), "%s%snetwork_client.tmp",  _paths.autosave_dir, PATHSEP);
 

	
 
		file_pointer = fopen(filename, "wb");
 
		if (file_pointer == NULL) {
network_server.c
Show inline comments
 
@@ -281,7 +281,7 @@ DEF_SERVER_SEND_COMMAND(PACKET_SERVER_MA
 
		Packet *p;
 

	
 
		// Make a dump of the current game
 
		snprintf(filename, lengthof(filename), "%s%snetwork_server.tmp",  _path.autosave_dir, PATHSEP);
 
		snprintf(filename, lengthof(filename), "%s%snetwork_server.tmp",  _paths.autosave_dir, PATHSEP);
 
		if (SaveOrLoad(filename, SL_SAVE) != SL_OK) error("network savedump failed");
 

	
 
		file_pointer = fopen(filename, "rb");
newgrf_config.c
Show inline comments
 
@@ -39,7 +39,7 @@ static bool CalcGRFMD5Sum(GRFConfig *con
 
	size_t len;
 

	
 
	/* open the file */
 
	snprintf(filename, lengthof(filename), "%s%s", _path.data_dir, config->filename);
 
	snprintf(filename, lengthof(filename), "%s%s", _paths.data_dir, config->filename);
 
	f = fopen(filename, "rb");
 
	if (f == NULL) return false;
 

	
 
@@ -176,7 +176,7 @@ static uint ScanPath(const char *path)
 
		} else if (sb.st_mode & S_IFREG) {
 
			/* File */
 
			char *ext = strrchr(filename, '.');
 
			char *file = filename + strlen(_path.data_dir) + 1; // Crop base path
 
			char *file = filename + strlen(_paths.data_dir) + 1; // Crop base path
 

	
 
			/* If no extension or extension isn't .grf, skip the file */
 
			if (ext == NULL) continue;
 
@@ -226,7 +226,7 @@ void ScanNewGRFFiles(void)
 
	_all_grfs = NULL;
 

	
 
	DEBUG(grf, 1) ("[GRF] Scanning for NewGRFs");
 
	num = ScanPath(_path.data_dir);
 
	num = ScanPath(_paths.data_dir);
 
	DEBUG(grf, 1) ("[GRF] Scan complete, found %d files", num);
 
}
 

	
openttd.c
Show inline comments
 
@@ -289,10 +289,10 @@ static void LoadIntroGame(void)
 
	SetupColorsAndInitialWindow();
 

	
 
	// Generate a world.
 
	snprintf(filename, lengthof(filename), "%sopntitle.dat",  _path.data_dir);
 
	snprintf(filename, lengthof(filename), "%sopntitle.dat",  _paths.data_dir);
 
#if defined SECOND_DATA_DIR
 
	if (SaveOrLoad(filename, SL_LOAD) != SL_OK) {
 
		snprintf(filename, lengthof(filename), "%sopntitle.dat",  _path.second_data_dir);
 
		snprintf(filename, lengthof(filename), "%sopntitle.dat",  _paths.second_data_dir);
 
	}
 
#endif
 
	if (SaveOrLoad(filename, SL_LOAD) != SL_OK) {
 
@@ -890,7 +890,7 @@ static void DoAutosave(void)
 
		const Player *p = GetPlayer(_local_player);
 
		char* s = buf;
 

	
 
		s += snprintf(buf, lengthof(buf), "%s%s", _path.autosave_dir, PATHSEP);
 
		s += snprintf(buf, lengthof(buf), "%s%s", _paths.autosave_dir, PATHSEP);
 

	
 
		SetDParam(0, p->name_1);
 
		SetDParam(1, p->name_2);
 
@@ -898,7 +898,7 @@ static void DoAutosave(void)
 
		s = GetString(s, STR_4004, lastof(buf));
 
		strecpy(s, ".sav", lastof(buf));
 
	} else { /* generate a savegame name and number according to _patches.max_num_autosaves */
 
		snprintf(buf, lengthof(buf), "%s%sautosave%d.sav", _path.autosave_dir, PATHSEP, _autosave_ctr);
 
		snprintf(buf, lengthof(buf), "%s%sautosave%d.sav", _paths.autosave_dir, PATHSEP, _autosave_ctr);
 

	
 
		_autosave_ctr++;
 
		if (_autosave_ctr >= _patches.max_num_autosaves) {
os2.c
Show inline comments
 
@@ -134,11 +134,11 @@ void DeterminePaths(void)
 
{
 
	char *s;
 

	
 
	_path.game_data_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_path.game_data_dir, GAME_DATA_DIR, MAX_PATH);
 
	_paths.game_data_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH);
 
	#if defined SECOND_DATA_DIR
 
	_path.second_data_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_path.second_data_dir, SECOND_DATA_DIR, MAX_PATH);
 
	_paths.second_data_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_paths.second_data_dir, SECOND_DATA_DIR, MAX_PATH);
 
	#endif
 

	
 
#if defined(USE_HOMEDIR)
 
@@ -150,59 +150,59 @@ void DeterminePaths(void)
 
			if (pw != NULL) homedir = pw->pw_dir;
 
		}
 

	
 
		_path.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR);
 
		_paths.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR);
 
	}
 

	
 
#else /* not defined(USE_HOMEDIR) */
 

	
 
	_path.personal_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_path.personal_dir, PERSONAL_DIR, MAX_PATH);
 
	_paths.personal_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_paths.personal_dir, PERSONAL_DIR, MAX_PATH);
 

	
 
	// check if absolute or relative path
 
	s = strchr(_path.personal_dir, '\\');
 
	s = strchr(_paths.personal_dir, '\\');
 

	
 
	// add absolute path
 
	if (s == NULL || _path.personal_dir != s) {
 
		getcwd(_path.personal_dir, MAX_PATH);
 
		s = strchr(_path.personal_dir, 0);
 
	if (s == NULL || _paths.personal_dir != s) {
 
		getcwd(_paths.personal_dir, MAX_PATH);
 
		s = strchr(_paths.personal_dir, 0);
 
		*s++ = '\\';
 
		ttd_strlcpy(s, PERSONAL_DIR, MAX_PATH);
 
	}
 

	
 
#endif /* defined(USE_HOMEDIR) */
 

	
 
	s = strchr(_path.personal_dir, 0);
 
	s = strchr(_paths.personal_dir, 0);
 

	
 
	// append a / ?
 
	if (s[-1] != '\\') strcpy(s, "\\");
 

	
 
	_path.save_dir = str_fmt("%ssave", _path.personal_dir);
 
	_path.autosave_dir = str_fmt("%s\\autosave", _path.save_dir);
 
	_path.scenario_dir = str_fmt("%sscenario", _path.personal_dir);
 
	_path.heightmap_dir = str_fmt("%sscenario\\heightmap", _path.personal_dir);
 
	_path.gm_dir = str_fmt("%sgm\\", _path.game_data_dir);
 
	_path.data_dir = str_fmt("%sdata\\", _path.game_data_dir);
 
	_paths.save_dir = str_fmt("%ssave", _paths.personal_dir);
 
	_paths.autosave_dir = str_fmt("%s\\autosave", _paths.save_dir);
 
	_paths.scenario_dir = str_fmt("%sscenario", _paths.personal_dir);
 
	_paths.heightmap_dir = str_fmt("%sscenario\\heightmap", _paths.personal_dir);
 
	_paths.gm_dir = str_fmt("%sgm\\", _paths.game_data_dir);
 
	_paths.data_dir = str_fmt("%sdata\\", _paths.game_data_dir);
 

	
 
	if (_config_file == NULL)
 
		_config_file = str_fmt("%sopenttd.cfg", _path.personal_dir);
 
		_config_file = str_fmt("%sopenttd.cfg", _paths.personal_dir);
 

	
 
	_highscore_file = str_fmt("%shs.dat", _path.personal_dir);
 
	_log_file = str_fmt("%sopenttd.log", _path.personal_dir);
 
	_highscore_file = str_fmt("%shs.dat", _paths.personal_dir);
 
	_log_file = str_fmt("%sopenttd.log", _paths.personal_dir);
 

	
 
#if defined CUSTOM_LANG_DIR
 
	// sets the search path for lng files to the custom one
 
	_path.lang_dir = malloc( MAX_PATH );
 
	ttd_strlcpy( _path.lang_dir, CUSTOM_LANG_DIR, MAX_PATH);
 
	_paths.lang_dir = malloc( MAX_PATH );
 
	ttd_strlcpy( _paths.lang_dir, CUSTOM_LANG_DIR, MAX_PATH);
 
#else
 
	_path.lang_dir = str_fmt("%slang\\", _path.game_data_dir);
 
	_paths.lang_dir = str_fmt("%slang\\", _paths.game_data_dir);
 
#endif
 

	
 
	// create necessary folders
 
	mkdir(_path.personal_dir);
 
	mkdir(_path.save_dir);
 
	mkdir(_path.autosave_dir);
 
	mkdir(_path.scenario_dir);
 
	mkdir(_path.heightmap_dir);
 
	mkdir(_paths.personal_dir);
 
	mkdir(_paths.save_dir);
 
	mkdir(_paths.autosave_dir);
 
	mkdir(_paths.scenario_dir);
 
	mkdir(_paths.heightmap_dir);
 
}
 

	
 
/**
saveload.c
Show inline comments
 
@@ -1649,7 +1649,7 @@ SaveOrLoadResult SaveOrLoad(const char *
 
void DoExitSave(void)
 
{
 
	char buf[200];
 
	snprintf(buf, sizeof(buf), "%s%sexit.sav", _path.autosave_dir, PATHSEP);
 
	snprintf(buf, sizeof(buf), "%s%sexit.sav", _paths.autosave_dir, PATHSEP);
 
	SaveOrLoad(buf, SL_SAVE);
 
}
 

	
screenshot.c
Show inline comments
 
@@ -512,7 +512,7 @@ static char *MakeScreenshotName(const ch
 

	
 
	serial = 0;
 
	for (;;) {
 
		snprintf(filename, sizeof(filename), "%s%s", _path.personal_dir, _screenshot_name);
 
		snprintf(filename, sizeof(filename), "%s%s", _paths.personal_dir, _screenshot_name);
 
		if (!FileExists(filename))
 
			break;
 
		sprintf(base, " #%d.%s", ++serial, ext);
strings.c
Show inline comments
 
@@ -1138,7 +1138,7 @@ bool ReadLanguagePack(int lang_index)
 
	char *s;
 

	
 
	{
 
		char *lang = str_fmt("%s%s", _path.lang_dir, _dynlang.ent[lang_index].file);
 
		char *lang = str_fmt("%s%s", _paths.lang_dir, _dynlang.ent[lang_index].file);
 
		lang_pack = ReadFileToMem(lang, &len, 200000);
 
		free(lang);
 
	}
 
@@ -1225,7 +1225,7 @@ static int GetLanguageList(char **langua
 
	struct dirent *dirent;
 
	int num = 0;
 

	
 
	dir = opendir(_path.lang_dir);
 
	dir = opendir(_paths.lang_dir);
 
	if (dir != NULL) {
 
		while ((dirent = readdir(dir)) != NULL) {
 
			const char *d_name = FS2OTTD(dirent->d_name);
 
@@ -1271,7 +1271,7 @@ void InitializeLanguagePacks(void)
 
	for (i = m = 0; i != n; i++) {
 
		size_t j;
 

	
 
		char *s = str_fmt("%s%s", _path.lang_dir, files[i]);
 
		char *s = str_fmt("%s%s", _paths.lang_dir, files[i]);
 
		in = fopen(s, "rb");
 
		free(s);
 
		if (in == NULL ||
unix.c
Show inline comments
 
@@ -169,11 +169,11 @@ void DeterminePaths(void)
 
{
 
	char *s;
 

	
 
	_path.game_data_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_path.game_data_dir, GAME_DATA_DIR, MAX_PATH);
 
	_paths.game_data_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH);
 
	#if defined SECOND_DATA_DIR
 
	_path.second_data_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_path.second_data_dir, SECOND_DATA_DIR, MAX_PATH);
 
	_paths.second_data_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_paths.second_data_dir, SECOND_DATA_DIR, MAX_PATH);
 
	#endif
 

	
 
#if defined(USE_HOMEDIR)
 
@@ -185,59 +185,59 @@ void DeterminePaths(void)
 
			if (pw != NULL) homedir = pw->pw_dir;
 
		}
 

	
 
		_path.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR);
 
		_paths.personal_dir = str_fmt("%s" PATHSEP "%s", homedir, PERSONAL_DIR);
 
	}
 

	
 
#else /* not defined(USE_HOMEDIR) */
 

	
 
	_path.personal_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_path.personal_dir, PERSONAL_DIR, MAX_PATH);
 
	_paths.personal_dir = malloc(MAX_PATH);
 
	ttd_strlcpy(_paths.personal_dir, PERSONAL_DIR, MAX_PATH);
 

	
 
	// check if absolute or relative path
 
	s = strchr(_path.personal_dir, '/');
 
	s = strchr(_paths.personal_dir, '/');
 

	
 
	// add absolute path
 
	if (s == NULL || _path.personal_dir != s) {
 
		getcwd(_path.personal_dir, MAX_PATH);
 
		s = strchr(_path.personal_dir, 0);
 
	if (s == NULL || _paths.personal_dir != s) {
 
		getcwd(_paths.personal_dir, MAX_PATH);
 
		s = strchr(_paths.personal_dir, 0);
 
		*s++ = '/';
 
		ttd_strlcpy(s, PERSONAL_DIR, MAX_PATH);
 
	}
 

	
 
#endif /* defined(USE_HOMEDIR) */
 

	
 
	s = strchr(_path.personal_dir, 0);
 
	s = strchr(_paths.personal_dir, 0);
 

	
 
	// append a / ?
 
	if (s[-1] != '/') strcpy(s, "/");
 

	
 
	_path.save_dir = str_fmt("%ssave", _path.personal_dir);
 
	_path.autosave_dir = str_fmt("%s/autosave", _path.save_dir);
 
	_path.scenario_dir = str_fmt("%sscenario", _path.personal_dir);
 
	_path.heightmap_dir = str_fmt("%sscenario/heightmap", _path.personal_dir);
 
	_path.gm_dir = str_fmt("%sgm/", _path.game_data_dir);
 
	_path.data_dir = str_fmt("%sdata/", _path.game_data_dir);
 
	_paths.save_dir = str_fmt("%ssave", _paths.personal_dir);
 
	_paths.autosave_dir = str_fmt("%s/autosave", _paths.save_dir);
 
	_paths.scenario_dir = str_fmt("%sscenario", _paths.personal_dir);
 
	_paths.heightmap_dir = str_fmt("%sscenario/heightmap", _paths.personal_dir);
 
	_paths.gm_dir = str_fmt("%sgm/", _paths.game_data_dir);
 
	_paths.data_dir = str_fmt("%sdata/", _paths.game_data_dir);
 

	
 
	if (_config_file == NULL)
 
		_config_file = str_fmt("%sopenttd.cfg", _path.personal_dir);
 
		_config_file = str_fmt("%sopenttd.cfg", _paths.personal_dir);
 

	
 
	_highscore_file = str_fmt("%shs.dat", _path.personal_dir);
 
	_log_file = str_fmt("%sopenttd.log", _path.personal_dir);
 
	_highscore_file = str_fmt("%shs.dat", _paths.personal_dir);
 
	_log_file = str_fmt("%sopenttd.log", _paths.personal_dir);
 

	
 
#if defined CUSTOM_LANG_DIR
 
	// sets the search path for lng files to the custom one
 
	_path.lang_dir = malloc( MAX_PATH );
 
	ttd_strlcpy( _path.lang_dir, CUSTOM_LANG_DIR, MAX_PATH);
 
	_paths.lang_dir = malloc( MAX_PATH );
 
	ttd_strlcpy( _paths.lang_dir, CUSTOM_LANG_DIR, MAX_PATH);
 
#else
 
	_path.lang_dir = str_fmt("%slang/", _path.game_data_dir);
 
	_paths.lang_dir = str_fmt("%slang/", _paths.game_data_dir);
 
#endif
 

	
 
	// create necessary folders
 
	mkdir(_path.personal_dir, 0755);
 
	mkdir(_path.save_dir, 0755);
 
	mkdir(_path.autosave_dir, 0755);
 
	mkdir(_path.scenario_dir, 0755);
 
	mkdir(_path.heightmap_dir, 0755);
 
	mkdir(_paths.personal_dir, 0755);
 
	mkdir(_paths.save_dir, 0755);
 
	mkdir(_paths.autosave_dir, 0755);
 
	mkdir(_paths.scenario_dir, 0755);
 
	mkdir(_paths.heightmap_dir, 0755);
 
}
 

	
 
bool InsertTextBufferClipboard(Textbuf *tb)
variables.h
Show inline comments
 
@@ -262,7 +262,7 @@ typedef struct Paths {
 
	char *second_data_dir;
 
} Paths;
 

	
 
VARDEF Paths _path;
 
VARDEF Paths _paths;
 

	
 
// NOSAVE: Used in palette animations only, not really important.
 
VARDEF int _timer_counter;
win32.c
Show inline comments
 
@@ -911,7 +911,7 @@ void DeterminePaths(void)
 
	char *s, *cfg;
 
	wchar_t path[MAX_PATH];
 

	
 
	_path.personal_dir = _path.game_data_dir = cfg = malloc(MAX_PATH);
 
	_paths.personal_dir = _paths.game_data_dir = cfg = malloc(MAX_PATH);
 
	GetCurrentDirectoryW(MAX_PATH - 1, path);
 
	convert_from_fs(path, cfg, MAX_PATH);
 

	
 
@@ -919,25 +919,25 @@ void DeterminePaths(void)
 
	s = strchr(cfg, '\0');
 
	if (s[-1] != '\\') strcpy(s, "\\");
 

	
 
	_path.save_dir = str_fmt("%ssave", cfg);
 
	_path.autosave_dir = str_fmt("%s\\autosave", _path.save_dir);
 
	_path.scenario_dir = str_fmt("%sscenario", cfg);
 
	_path.heightmap_dir = str_fmt("%sscenario\\heightmap", cfg);
 
	_path.gm_dir = str_fmt("%sgm\\", cfg);
 
	_path.data_dir = str_fmt("%sdata\\", cfg);
 
	_path.lang_dir = str_fmt("%slang\\", cfg);
 
	_paths.save_dir = str_fmt("%ssave", cfg);
 
	_paths.autosave_dir = str_fmt("%s\\autosave", _paths.save_dir);
 
	_paths.scenario_dir = str_fmt("%sscenario", cfg);
 
	_paths.heightmap_dir = str_fmt("%sscenario\\heightmap", cfg);
 
	_paths.gm_dir = str_fmt("%sgm\\", cfg);
 
	_paths.data_dir = str_fmt("%sdata\\", cfg);
 
	_paths.lang_dir = str_fmt("%slang\\", cfg);
 

	
 
	if (_config_file == NULL)
 
		_config_file = str_fmt("%sopenttd.cfg", _path.personal_dir);
 
		_config_file = str_fmt("%sopenttd.cfg", _paths.personal_dir);
 

	
 
	_highscore_file = str_fmt("%shs.dat", _path.personal_dir);
 
	_log_file = str_fmt("%sopenttd.log", _path.personal_dir);
 
	_highscore_file = str_fmt("%shs.dat", _paths.personal_dir);
 
	_log_file = str_fmt("%sopenttd.log", _paths.personal_dir);
 

	
 
	// make (auto)save and scenario folder
 
	CreateDirectoryW(OTTD2FS(_path.save_dir), NULL);
 
	CreateDirectoryW(OTTD2FS(_path.autosave_dir), NULL);
 
	CreateDirectoryW(OTTD2FS(_path.scenario_dir), NULL);
 
	CreateDirectoryW(OTTD2FS(_path.heightmap_dir), NULL);
 
	CreateDirectoryW(OTTD2FS(_paths.save_dir), NULL);
 
	CreateDirectoryW(OTTD2FS(_paths.autosave_dir), NULL);
 
	CreateDirectoryW(OTTD2FS(_paths.scenario_dir), NULL);
 
	CreateDirectoryW(OTTD2FS(_paths.heightmap_dir), NULL);
 
}
 

	
 
/**
0 comments (0 inline, 0 general)