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)
{
if (0 == strcmp(s_argv[i], charFileName))
if (0 == strcmp(s_argv[i].GetChars(), charFileName))
{
return FALSE;
}

View file

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

View file

@ -86,13 +86,13 @@ static const char* const tableHeaders[NUM_COLUMNS] = { "IWAD", "Game" };
for(int i = 0;i < numwads;i++)
{
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)
filename = wads[i].Path;
filename = wads[i].Path.GetChars();
else
filename++;
[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];
[record release];
}
@ -397,9 +397,9 @@ static void RestartWithParameters(const WadStuff& wad, NSString* parameters)
[arguments addObject:GetArchitectureString()];
[arguments addObject:executablePath];
[arguments addObject:@"-iwad"];
[arguments addObject:[NSString stringWithUTF8String:wad.Path]];
[arguments addObject:[NSString stringWithUTF8String:wad.Path.GetChars()]];
[arguments addObject:@"+defaultiwad"];
[arguments addObject:[NSString stringWithUTF8String:wad.Name]];
[arguments addObject:[NSString stringWithUTF8String:wad.Name.GetChars()]];
[arguments addObject:cvarArgument];
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);
}
FString who(path, slash - path);
pwstruct = getpwnam(who);
pwstruct = getpwnam(who.GetChars());
}
if (pwstruct == NULL)
{

View file

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

View file

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