fix GetChars in linux/macOS

This commit is contained in:
Ricardo Luís Vaz Silva 2023-10-07 19:34:06 -03:00 committed by Christoph Oelckers
parent 6055ff029d
commit c69941e49d
6 changed files with 27 additions and 27 deletions

View file

@ -348,7 +348,7 @@ extern bool AppActive;
for (size_t i = 0, count = s_argv.Size(); i < count; ++i) for (size_t i = 0, count = s_argv.Size(); i < count; ++i)
{ {
if (0 == strcmp(s_argv[i], charFileName)) if (0 == strcmp(s_argv[i].GetChars(), charFileName))
{ {
return FALSE; return FALSE;
} }

View file

@ -105,7 +105,7 @@ FString M_GetAppDataPath(bool create)
} }
path += "/" GAMENAMELOWERCASE; path += "/" GAMENAMELOWERCASE;
if (create) CreatePath(path); if (create) CreatePath(path.GetChars());
return path; return path;
} }
@ -127,7 +127,7 @@ FString M_GetCachePath(bool create)
} }
path += "/zdoom/cache"; path += "/zdoom/cache";
if (create) CreatePath(path); if (create) CreatePath(path.GetChars());
return path; return path;
} }
@ -169,9 +169,9 @@ FString M_GetConfigPath(bool for_reading)
{ {
// There seems to be no way to get Preferences path via NSFileManager // There seems to be no way to get Preferences path via NSFileManager
path += "/Preferences/"; path += "/Preferences/";
CreatePath(path); CreatePath(path.GetChars());
if (!DirExists(path)) if (!DirExists(path.GetChars()))
{ {
path = FString(); path = FString();
} }
@ -200,7 +200,7 @@ FString M_GetScreenshotsPath()
{ {
path += "/" GAME_DIR "/Screenshots/"; path += "/" GAME_DIR "/Screenshots/";
} }
CreatePath(path); CreatePath(path.GetChars());
return path; return path;
} }
@ -241,7 +241,7 @@ FString M_GetDocumentsPath()
path += "/" GAME_DIR "/"; path += "/" GAME_DIR "/";
} }
CreatePath(path); CreatePath(path.GetChars());
return path; return path;
} }

View file

@ -86,13 +86,13 @@ static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
for(int i = 0;i < numwads;i++) for(int i = 0;i < numwads;i++)
{ {
NSMutableDictionary *record = [[NSMutableDictionary alloc] initWithCapacity:NUM_COLUMNS]; NSMutableDictionary *record = [[NSMutableDictionary alloc] initWithCapacity:NUM_COLUMNS];
const char* filename = strrchr(wads[i].Path, '/'); const char* filename = strrchr(wads[i].Path.GetChars(), '/');
if(filename == NULL) if(filename == NULL)
filename = wads[i].Path; filename = wads[i].Path.GetChars();
else else
filename++; filename++;
[record setObject:[NSString stringWithUTF8String:filename] forKey:[NSString stringWithUTF8String:tableHeaders[COLUMN_IWAD]]]; [record setObject:[NSString stringWithUTF8String:filename] forKey:[NSString stringWithUTF8String:tableHeaders[COLUMN_IWAD]]];
[record setObject:[NSString stringWithUTF8String:wads[i].Name] forKey:[NSString stringWithUTF8String:tableHeaders[COLUMN_GAME]]]; [record setObject:[NSString stringWithUTF8String:wads[i].Name.GetChars()] forKey:[NSString stringWithUTF8String:tableHeaders[COLUMN_GAME]]];
[data addObject:record]; [data addObject:record];
[record release]; [record release];
} }
@ -397,9 +397,9 @@ static void RestartWithParameters(const WadStuff& wad, NSString* parameters)
[arguments addObject:GetArchitectureString()]; [arguments addObject:GetArchitectureString()];
[arguments addObject:executablePath]; [arguments addObject:executablePath];
[arguments addObject:@"-iwad"]; [arguments addObject:@"-iwad"];
[arguments addObject:[NSString stringWithUTF8String:wad.Path]]; [arguments addObject:[NSString stringWithUTF8String:wad.Path.GetChars()]];
[arguments addObject:@"+defaultiwad"]; [arguments addObject:@"+defaultiwad"];
[arguments addObject:[NSString stringWithUTF8String:wad.Name]]; [arguments addObject:[NSString stringWithUTF8String:wad.Name.GetChars()]];
[arguments addObject:cvarArgument]; [arguments addObject:cvarArgument];
for (int i = 1, count = Args->NumArgs(); i < count; ++i) for (int i = 1, count = Args->NumArgs(); i < count; ++i)

View file

@ -905,7 +905,7 @@ FString NicePath(const char *path)
slash = path + strlen(path); slash = path + strlen(path);
} }
FString who(path, slash - path); FString who(path, slash - path);
pwstruct = getpwnam(who); pwstruct = getpwnam(who.GetChars());
} }
if (pwstruct == NULL) if (pwstruct == NULL)
{ {

View file

@ -108,10 +108,10 @@ FGameConfigFile::FGameConfigFile ()
SetValueForKey ("Path", ".", true); SetValueForKey ("Path", ".", true);
SetValueForKey ("Path", "$DOOMWADDIR", true); SetValueForKey ("Path", "$DOOMWADDIR", true);
#ifdef __APPLE__ #ifdef __APPLE__
SetValueForKey ("Path", user_docs, true); SetValueForKey ("Path", user_docs.GetChars(), true);
SetValueForKey ("Path", user_app_support, true); SetValueForKey ("Path", user_app_support.GetChars(), true);
SetValueForKey ("Path", "$PROGDIR", true); SetValueForKey ("Path", "$PROGDIR", true);
SetValueForKey ("Path", local_app_support, true); SetValueForKey ("Path", local_app_support.GetChars(), true);
#elif !defined(__unix__) #elif !defined(__unix__)
SetValueForKey ("Path", "$HOME", true); SetValueForKey ("Path", "$HOME", true);
SetValueForKey ("Path", "$PROGDIR", true); SetValueForKey ("Path", "$PROGDIR", true);
@ -133,10 +133,10 @@ FGameConfigFile::FGameConfigFile ()
{ {
SetSection ("FileSearch.Directories", true); SetSection ("FileSearch.Directories", true);
#ifdef __APPLE__ #ifdef __APPLE__
SetValueForKey ("Path", user_docs, true); SetValueForKey ("Path", user_docs.GetChars(), true);
SetValueForKey ("Path", user_app_support, true); SetValueForKey ("Path", user_app_support.GetChars(), true);
SetValueForKey ("Path", "$PROGDIR", true); SetValueForKey ("Path", "$PROGDIR", true);
SetValueForKey ("Path", local_app_support, true); SetValueForKey ("Path", local_app_support.GetChars(), true);
#elif !defined(__unix__) #elif !defined(__unix__)
SetValueForKey ("Path", "$PROGDIR", true); SetValueForKey ("Path", "$PROGDIR", true);
#else #else
@ -156,14 +156,14 @@ FGameConfigFile::FGameConfigFile ()
{ {
SetSection("SoundfontSearch.Directories", true); SetSection("SoundfontSearch.Directories", true);
#ifdef __APPLE__ #ifdef __APPLE__
SetValueForKey("Path", user_docs + "/soundfonts", true); SetValueForKey("Path", (user_docs + "/soundfonts").GetChars(), true);
SetValueForKey("Path", user_docs + "/fm_banks", true); SetValueForKey("Path", (user_docs + "/fm_banks").GetChars(), true);
SetValueForKey("Path", user_app_support + "/soundfonts", true); SetValueForKey("Path", (user_app_support + "/soundfonts").GetChars(), true);
SetValueForKey("Path", user_app_support + "/fm_banks", true); SetValueForKey("Path", (user_app_support + "/fm_banks").GetChars(), true);
SetValueForKey("Path", "$PROGDIR/soundfonts", true); SetValueForKey("Path", "$PROGDIR/soundfonts", true);
SetValueForKey("Path", "$PROGDIR/fm_banks", true); SetValueForKey("Path", "$PROGDIR/fm_banks", true);
SetValueForKey("Path", local_app_support + "/soundfonts", true); SetValueForKey("Path", (local_app_support + "/soundfonts").GetChars(), true);
SetValueForKey("Path", local_app_support + "/fm_banks", true); SetValueForKey("Path", (local_app_support + "/fm_banks").GetChars(), true);
#elif !defined(__unix__) #elif !defined(__unix__)
SetValueForKey("Path", "$PROGDIR/soundfonts", true); SetValueForKey("Path", "$PROGDIR/soundfonts", true);
SetValueForKey("Path", "$PROGDIR/fm_banks", true); SetValueForKey("Path", "$PROGDIR/fm_banks", true);

View file

@ -202,7 +202,7 @@ TArray<FString> I_GetSteamPath()
try try
{ {
SteamInstallFolders = ParseSteamRegistry(regPath); SteamInstallFolders = ParseSteamRegistry(regPath.GetChars());
} }
catch(class CRecoverableError &error) catch(class CRecoverableError &error)
{ {
@ -221,7 +221,7 @@ TArray<FString> I_GetSteamPath()
{ {
struct stat st; struct stat st;
FString candidate(SteamInstallFolders[i] + "/" + AppInfo[app].BasePath); FString candidate(SteamInstallFolders[i] + "/" + AppInfo[app].BasePath);
if(DirExists(candidate)) if(DirExists(candidate.GetChars()))
result.Push(candidate); result.Push(candidate);
} }
} }