Skip to content

Commit

Permalink
more GetChars fixes in linux/macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
RicardoLuis0 committed Oct 7, 2023
1 parent 60ba65f commit 044e5bc
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 21 deletions.
16 changes: 8 additions & 8 deletions src/common/platform/posix/sdl/i_system.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ void Unix_I_FatalError(const char* errortext)
FString cmd;
cmd << "kdialog --title \"" GAMENAME " " << GetVersionString()
<< "\" --msgbox \"" << errortext << "\"";
popen(cmd, "r");
popen(cmd.GetChars(), "r");
}
#ifndef NO_GTK
else if (I_GtkAvailable())
Expand All @@ -131,7 +131,7 @@ void Unix_I_FatalError(const char* errortext)
FString title;
title << GAMENAME " " << GetVersionString();

if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title, errortext, NULL) < 0)
if (SDL_ShowSimpleMessageBox(SDL_MESSAGEBOX_ERROR, title.GetChars(), errortext, NULL) < 0)
{
printf("\n%s\n", errortext);
}
Expand Down Expand Up @@ -316,9 +316,9 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad, int&

for(i = 0; i < numwads; ++i)
{
const char *filepart = strrchr(wads[i].Path, '/');
const char *filepart = strrchr(wads[i].Path.GetChars(), '/');
if(filepart == NULL)
filepart = wads[i].Path;
filepart = wads[i].Path.GetChars();
else
filepart++;
// Menu entries are specified in "tag" "item" pairs, where when a
Expand All @@ -329,9 +329,9 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad, int&

if(defaultiwad >= 0 && defaultiwad < numwads)
{
const char *filepart = strrchr(wads[defaultiwad].Path, '/');
const char *filepart = strrchr(wads[defaultiwad].Path.GetChars(), '/');
if(filepart == NULL)
filepart = wads[defaultiwad].Path;
filepart = wads[defaultiwad].Path.GetChars();
else
filepart++;
cmd.AppendFormat(" --default \"%s (%s)\"", wads[defaultiwad].Name.GetChars(), filepart);
Expand Down Expand Up @@ -377,9 +377,9 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad, int&
printf ("Please select a game wad (or 0 to exit):\n");
for (i = 0; i < numwads; ++i)
{
const char *filepart = strrchr (wads[i].Path, '/');
const char *filepart = strrchr (wads[i].Path.GetChars(), '/');
if (filepart == NULL)
filepart = wads[i].Path;
filepart = wads[i].Path.GetChars();
else
filepart++;
printf ("%d. %s (%s)\n", i+1, wads[i].Name.GetChars(), filepart);
Expand Down
4 changes: 2 additions & 2 deletions src/common/platform/posix/sdl/sdlglvideo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ namespace Priv
caption.Format(GAMENAME " %s (%s)", GetVersionString(), GetGitTime());

const uint32_t windowFlags = (win_maximized ? SDL_WINDOW_MAXIMIZED : 0) | SDL_WINDOW_RESIZABLE | extraFlags;
Priv::window = SDL_CreateWindow(caption,
Priv::window = SDL_CreateWindow(caption.GetChars(),
(win_x <= 0) ? SDL_WINDOWPOS_CENTERED_DISPLAY(vid_adapter) : win_x,
(win_y <= 0) ? SDL_WINDOWPOS_CENTERED_DISPLAY(vid_adapter) : win_y,
win_w, win_h, windowFlags);
Expand Down Expand Up @@ -585,7 +585,7 @@ void I_SetWindowTitle(const char* caption)
{
FString default_caption;
default_caption.Format(GAMENAME " %s (%s)", GetVersionString(), GetGitTime());
SDL_SetWindowTitle(Priv::window, default_caption);
SDL_SetWindowTitle(Priv::window, default_caption.GetChars());
}
}

16 changes: 8 additions & 8 deletions src/common/platform/posix/unix/i_specialpaths.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,15 +50,15 @@ FString GetUserFile (const char *file)

path = NicePath("$HOME/" GAME_DIR "/");

if (stat (path, &info) == -1)
if (stat (path.GetChars(), &info) == -1)
{
struct stat extrainfo;

// Sanity check for $HOME/.config
FString configPath = NicePath("$HOME/.config/");
if (stat (configPath, &extrainfo) == -1)
if (stat (configPath.GetChars(), &extrainfo) == -1)
{
if (mkdir (configPath, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
if (mkdir (configPath.GetChars(), S_IRUSR | S_IWUSR | S_IXUSR) == -1)
{
I_FatalError ("Failed to create $HOME/.config directory:\n%s", strerror(errno));
}
Expand All @@ -72,9 +72,9 @@ FString GetUserFile (const char *file)
// Transfer the old zdoom directory to the new location
bool moved = false;
FString oldpath = NicePath("$HOME/." GAMENAMELOWERCASE "/");
if (stat (oldpath, &extrainfo) != -1)
if (stat (oldpath.GetChars(), &extrainfo) != -1)
{
if (rename(oldpath, path) == -1)
if (rename(oldpath.GetChars(), path) == -1)
{
I_Error ("Failed to move old " GAMENAMELOWERCASE " directory (%s) to new location (%s).",
oldpath.GetChars(), path.GetChars());
Expand Down Expand Up @@ -115,7 +115,7 @@ FString M_GetAppDataPath(bool create)
FString path = NicePath("$HOME/.config/" GAMENAMELOWERCASE);
if (create)
{
CreatePath(path);
CreatePath(path.GetChars());
}
return path;
}
Expand All @@ -135,7 +135,7 @@ FString M_GetCachePath(bool create)
FString path = NicePath("$HOME/.config/zdoom/cache");
if (create)
{
CreatePath(path);
CreatePath(path.GetChars());
}
return path;
}
Expand Down Expand Up @@ -231,7 +231,7 @@ FString M_GetDemoPath()
FString M_GetNormalizedPath(const char* path)
{
char *actualpath;
actualpath = realpath(path, NULL);
actualpath = realpath(path.GetChars(), NULL);
if (!actualpath) // error ?
return nullptr;
FString fullpath = actualpath;
Expand Down
2 changes: 1 addition & 1 deletion src/ct_chat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ bool CT_Responder (event_t *ev)
#ifdef __unix__
else if (ev->subtype == EV_GUI_MButtonDown)
{
CT_PasteChat(I_GetFromClipboard(true));
CT_PasteChat(I_GetFromClipboard(true).GetChars());
}
#endif
}
Expand Down
2 changes: 1 addition & 1 deletion src/d_main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2041,7 +2041,7 @@ static void AddAutoloadFiles(const char *autoname, std::vector<std::string>& all

#ifdef __unix__
file = NicePath("$HOME/" GAME_DIR "/skins");
D_AddDirectory (allwads, file, "*.wad", GameConfig);
D_AddDirectory (allwads, file.GetChars(), "*.wad", GameConfig);
#endif

// Add common (global) wads
Expand Down
2 changes: 1 addition & 1 deletion src/posix/i_steam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ TArray<FString> I_GetSteamPath()
FString regPath = appSupportPath + "/Steam/config/config.vdf";
try
{
SteamInstallFolders = ParseSteamRegistry(regPath);
SteamInstallFolders = ParseSteamRegistry(regPath.GetChars());
}
catch(class CRecoverableError &error)
{
Expand Down

0 comments on commit 044e5bc

Please sign in to comment.