more GetChars fixes in linux/macOS

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

View file

@ -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())
@ -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);
}
@ -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
@ -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);
@ -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);

View file

@ -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);
@ -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());
}
}

View file

@ -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));
}
@ -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());
@ -115,7 +115,7 @@ FString M_GetAppDataPath(bool create)
FString path = NicePath("$HOME/.config/" GAMENAMELOWERCASE);
if (create)
{
CreatePath(path);
CreatePath(path.GetChars());
}
return path;
}
@ -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;
}
@ -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;

View file

@ -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
}

View file

@ -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

View file

@ -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)
{