equal
deleted
inserted
replaced
31 bool FiosIsRoot(const char *file) |
31 bool FiosIsRoot(const char *file) |
32 { |
32 { |
33 return file[3] == '\0'; |
33 return file[3] == '\0'; |
34 } |
34 } |
35 |
35 |
36 void FiosGetDrives(void) |
36 void FiosGetDrives() |
37 { |
37 { |
38 unsigned disk, disk2, save, total; |
38 unsigned disk, disk2, save, total; |
39 |
39 |
40 #ifndef __INNOTEK_LIBC__ |
40 #ifndef __INNOTEK_LIBC__ |
41 _dos_getdrive(&save); // save original drive |
41 _dos_getdrive(&save); // save original drive |
112 bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb) |
112 bool FiosIsValidFile(const char *path, const struct dirent *ent, struct stat *sb) |
113 { |
113 { |
114 char filename[MAX_PATH]; |
114 char filename[MAX_PATH]; |
115 |
115 |
116 snprintf(filename, lengthof(filename), "%s" PATHSEP "%s", path, ent->d_name); |
116 snprintf(filename, lengthof(filename), "%s" PATHSEP "%s", path, ent->d_name); |
117 if (stat(filename, sb) != 0) return false; |
117 return stat(filename, sb) == 0; |
118 |
118 } |
119 return (ent->d_name[0] != '.'); // hidden file |
119 |
120 } |
120 bool FiosIsHiddenFile(const struct dirent *ent) |
|
121 { |
|
122 return ent->d_name[0] == '.'; |
|
123 } |
|
124 |
121 |
125 |
122 static void ChangeWorkingDirectory(char *exe) |
126 static void ChangeWorkingDirectory(char *exe) |
123 { |
127 { |
124 char *s = strrchr(exe, PATHSEPCHAR); |
128 char *s = strrchr(exe, PATHSEPCHAR); |
125 |
129 |
172 _random_seeds[1][1] = _random_seeds[1][0] = _random_seeds[0][1] = _random_seeds[0][0] = time(NULL); |
176 _random_seeds[1][1] = _random_seeds[1][0] = _random_seeds[0][1] = _random_seeds[0][0] = time(NULL); |
173 |
177 |
174 return ttd_main(argc, argv); |
178 return ttd_main(argc, argv); |
175 } |
179 } |
176 |
180 |
177 void DeterminePaths(void) |
181 void DeterminePaths() |
178 { |
182 { |
179 char *s; |
183 char *s; |
180 |
184 |
181 _paths.game_data_dir = (char *)malloc(MAX_PATH); |
185 _paths.game_data_dir = (char *)malloc(MAX_PATH); |
182 ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH); |
186 ttd_strlcpy(_paths.game_data_dir, GAME_DATA_DIR, MAX_PATH); |