mirror of
https://github.com/isledecomp/isle-portable.git
synced 2025-09-24 04:26:55 -04:00
Fix Windows file finding (#369)
This commit is contained in:
parent
ed71ac8ec2
commit
c2b8abea36
@ -1062,21 +1062,22 @@ MxResult IsleApp::VerifyFilesystem()
|
|||||||
Emscripten_SetupFilesystem();
|
Emscripten_SetupFilesystem();
|
||||||
#else
|
#else
|
||||||
for (const char* file : g_files) {
|
for (const char* file : g_files) {
|
||||||
MxString path(&file[1]);
|
|
||||||
path.MapPathToFilesystem();
|
|
||||||
|
|
||||||
const char* searchPaths[] = {".", m_hdPath, m_cdPath};
|
const char* searchPaths[] = {".", m_hdPath, m_cdPath};
|
||||||
char buffer[1024];
|
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
for (const char* base : searchPaths) {
|
for (const char* base : searchPaths) {
|
||||||
SDL_snprintf(buffer, sizeof(buffer), "%s%s", base, path.GetData());
|
MxString path(base);
|
||||||
found = SDL_GetPathInfo(buffer, NULL);
|
path += file;
|
||||||
if (found) {
|
path.MapPathToFilesystem();
|
||||||
|
|
||||||
|
if (SDL_GetPathInfo(path.GetData(), NULL)) {
|
||||||
|
found = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!found) {
|
if (!found) {
|
||||||
|
char buffer[1024];
|
||||||
SDL_snprintf(
|
SDL_snprintf(
|
||||||
buffer,
|
buffer,
|
||||||
sizeof(buffer),
|
sizeof(buffer),
|
||||||
|
@ -24,7 +24,7 @@ public:
|
|||||||
const MxString& operator=(const char* p_str);
|
const MxString& operator=(const char* p_str);
|
||||||
MxString operator+(const MxString& p_str) const;
|
MxString operator+(const MxString& p_str) const;
|
||||||
MxString operator+(const char* p_str) const;
|
MxString operator+(const char* p_str) const;
|
||||||
MxString& operator+=(const char* p_str);
|
LEGO1_EXPORT MxString& operator+=(const char* p_str);
|
||||||
|
|
||||||
static void CharSwap(char* p_a, char* p_b);
|
static void CharSwap(char* p_a, char* p_b);
|
||||||
LEGO1_EXPORT static void MapPathToFilesystem(char* p_path);
|
LEGO1_EXPORT static void MapPathToFilesystem(char* p_path);
|
||||||
|
@ -229,5 +229,14 @@ void MxString::MapPathToFilesystem(char* p_path)
|
|||||||
if (!mapPath(MxOmni::GetHDFiles())) {
|
if (!mapPath(MxOmni::GetHDFiles())) {
|
||||||
mapPath(MxOmni::GetCDFiles());
|
mapPath(MxOmni::GetCDFiles());
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
char* path = p_path;
|
||||||
|
while (*path) {
|
||||||
|
if (*path == '/') {
|
||||||
|
*path = '\\';
|
||||||
|
}
|
||||||
|
|
||||||
|
path++;
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user