Skip to content

Commit

Permalink
fix GetChars in linux/macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 committed Oct 7, 2023
1 parent 6055ff0 commit 60ba65f
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/common/platform/posix/cocoa/i_main.mm
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ - (BOOL)application:(NSApplication*)theApplication openFile:(NSString*)filename

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;
}
Expand Down
12 changes: 6 additions & 6 deletions src/common/platform/posix/osx/i_specialpaths.mm
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ FString M_GetAppDataPath(bool create)
}

path += "/" GAMENAMELOWERCASE;
if (create) CreatePath(path);
if (create) CreatePath(path.GetChars());
return path;
}

Expand All @@ -127,7 +127,7 @@ FString M_GetCachePath(bool create)
}

path += "/zdoom/cache";
if (create) CreatePath(path);
if (create) CreatePath(path.GetChars());
return path;
}

Expand Down Expand Up @@ -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();
}
Expand Down Expand Up @@ -200,7 +200,7 @@ FString M_GetScreenshotsPath()
{
path += "/" GAME_DIR "/Screenshots/";
}
CreatePath(path);
CreatePath(path.GetChars());
return path;
}

Expand Down Expand Up @@ -241,7 +241,7 @@ FString M_GetDocumentsPath()
path += "/" GAME_DIR "/";
}

CreatePath(path);
CreatePath(path.GetChars());
return path;
}

Expand Down
10 changes: 5 additions & 5 deletions src/common/platform/posix/osx/iwadpicker_cocoa.mm
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ - (IWADTableData *)init:(WadStuff *) wads num:(int) numwads
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];
}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/common/utility/cmdlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
24 changes: 12 additions & 12 deletions src/gameconfigfile.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand All @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/posix/i_steam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ TArray<FString> I_GetSteamPath()

try
{
SteamInstallFolders = ParseSteamRegistry(regPath);
SteamInstallFolders = ParseSteamRegistry(regPath.GetChars());
}
catch(class CRecoverableError &error)
{
Expand All @@ -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);
}
}
Expand Down

0 comments on commit 60ba65f

Please sign in to comment.