19 PLATFORM_UNINITIALIZED = -1,
27var platform g_platform = PLATFORM_UNINITIALIZED;
31Platform_GetPlatform(
void)
33 if (g_platform == PLATFORM_UNINITIALIZED) {
34 string osname = cvar_string(
"sys_platform");
35 g_platform = PLATFORM_UNKNOWN;
39 g_platform = PLATFORM_WEB;
43 g_platform = PLATFORM_CONSOLE;
49 g_platform = PLATFORM_TOUCH;
68 g_platform = PLATFORM_PC;
77Platform_FileInGamedir(
string fileName,
string gameDir)
79 searchhandle fileSearch;
82 fileSearch = search_begin(fileName, SEARCH_FULLPACKAGE, TRUE);
83 fileCount = search_getsize(fileSearch);
85 NSLog(
"Looking for %S in %S", fileName, gameDir);
89 search_end(fileSearch);
93 for (
int i = 0; i < fileCount; i++) {
95 string fullPath = search_getpackagename(fileSearch, i);
96 fileDir = substring(fullPath, 0, strlen(gameDir));
98 if (fileDir == gameDir) {
99 NSLog(
"Found %S in %S", fileName, gameDir);
100 search_end(fileSearch);
105 NSError(
"Did not find %S in %S", fileName, gameDir);
106 search_end(fileSearch);
113Platform_FileInCurrentGamedir(
string fileName)
115 string gameDir = cvar_string(
"game");
116 return Platform_FileInGamedir(fileName, gameDir);