os2.c
changeset 3329 992d1f7cb747
parent 3287 720ed37be8c6
child 3800 6ea101b2464b
equal deleted inserted replaced
3328:85bf1744f435 3329:992d1f7cb747
   106 					strcmp(dirent->d_name, "..") != 0) {
   106 					strcmp(dirent->d_name, "..") != 0) {
   107 				fios = FiosAlloc();
   107 				fios = FiosAlloc();
   108 				fios->type = FIOS_TYPE_DIR;
   108 				fios->type = FIOS_TYPE_DIR;
   109 				fios->mtime = 0;
   109 				fios->mtime = 0;
   110 				ttd_strlcpy(fios->name, dirent->d_name, lengthof(fios->name));
   110 				ttd_strlcpy(fios->name, dirent->d_name, lengthof(fios->name));
   111 				snprintf(fios->title, lengthof(fios->title), "%s\\ (Directory)", dirent->d_name);
   111 				snprintf(fios->title, lengthof(fios->title), "%s\\ (Directory)", FS2OTTD(dirent->d_name));
   112 				str_validate(fios->title);
   112 				str_validate(fios->title);
   113 			}
   113 			}
   114 		}
   114 		}
   115 		closedir(dir);
   115 		closedir(dir);
   116 	}
   116 	}
   148 				fios->type = FIOS_TYPE_FILE;
   148 				fios->type = FIOS_TYPE_FILE;
   149 				fios->mtime = sb.st_mtime;
   149 				fios->mtime = sb.st_mtime;
   150 				ttd_strlcpy(fios->name, dirent->d_name, lengthof(fios->name));
   150 				ttd_strlcpy(fios->name, dirent->d_name, lengthof(fios->name));
   151 
   151 
   152 				*t = '\0'; // strip extension
   152 				*t = '\0'; // strip extension
   153 				ttd_strlcpy(fios->title, dirent->d_name, lengthof(fios->title));
   153 				ttd_strlcpy(fios->title, FS2OTTD(dirent->d_name), lengthof(fios->title));
   154 				str_validate(fios->title);
   154 				str_validate(fios->title);
   155 			} else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO) {
   155 			} else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO) {
   156 				if (strcasecmp(t, ".ss1") == 0 ||
   156 				if (strcasecmp(t, ".ss1") == 0 ||
   157 						strcasecmp(t, ".sv1") == 0 ||
   157 						strcasecmp(t, ".sv1") == 0 ||
   158 						strcasecmp(t, ".sv2") == 0) { // TTDLX(Patch)
   158 						strcasecmp(t, ".sv2") == 0) { // TTDLX(Patch)
   235 					strcmp(dirent->d_name, "..") != 0) {
   235 					strcmp(dirent->d_name, "..") != 0) {
   236 				fios = FiosAlloc();
   236 				fios = FiosAlloc();
   237 				fios->type = FIOS_TYPE_DIR;
   237 				fios->type = FIOS_TYPE_DIR;
   238 				fios->mtime = 0;
   238 				fios->mtime = 0;
   239 				ttd_strlcpy(fios->name, dirent->d_name, lengthof(fios->name));
   239 				ttd_strlcpy(fios->name, dirent->d_name, lengthof(fios->name));
   240 				snprintf(fios->title, lengthof(fios->title), "%s\\ (Directory)", dirent->d_name);
   240 				snprintf(fios->title, lengthof(fios->title), "%s\\ (Directory)", FS2OTTD(dirent->d_name));
   241 				str_validate(fios->title);
   241 				str_validate(fios->title);
   242 			}
   242 			}
   243 		}
   243 		}
   244 		closedir(dir);
   244 		closedir(dir);
   245 	}
   245 	}
   276 				fios->type = FIOS_TYPE_SCENARIO;
   276 				fios->type = FIOS_TYPE_SCENARIO;
   277 				fios->mtime = sb.st_mtime;
   277 				fios->mtime = sb.st_mtime;
   278 				ttd_strlcpy(fios->name, dirent->d_name, lengthof(fios->name));
   278 				ttd_strlcpy(fios->name, dirent->d_name, lengthof(fios->name));
   279 
   279 
   280 				*t = '\0'; // strip extension
   280 				*t = '\0'; // strip extension
   281 				ttd_strlcpy(fios->title, dirent->d_name, lengthof(fios->title));
   281 				ttd_strlcpy(fios->title, FS2OTTD(dirent->d_name), lengthof(fios->title));
   282 				str_validate(fios->title);
   282 				str_validate(fios->title);
   283 			} else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO ||
   283 			} else if (mode == SLD_LOAD_GAME || mode == SLD_LOAD_SCENARIO ||
   284 					mode == SLD_NEW_GAME) {
   284 					mode == SLD_NEW_GAME) {
   285 				if (strcasecmp(t, ".sv0") == 0 ||
   285 				if (strcasecmp(t, ".sv0") == 0 ||
   286 						strcasecmp(t, ".ss0") == 0) { // TTDLX(Patch)
   286 						strcasecmp(t, ".ss0") == 0) { // TTDLX(Patch)