mirror of
https://github.com/ZDoom/Raze.git
synced 2025-02-22 11:31:11 +00:00
GetChars in non-windows code.
This commit is contained in:
parent
a2b93fdc23
commit
5919232fa7
9 changed files with 35 additions and 35 deletions
|
@ -552,7 +552,7 @@ public:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
File->Seek(-sizeof(header), FileReader::SeekCur);
|
File->Seek(-(ptrdiff_t)sizeof(header), FileReader::SeekCur);
|
||||||
|
|
||||||
FillBuffer();
|
FillBuffer();
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -118,7 +118,7 @@ void Unix_I_FatalError(const char* errortext)
|
||||||
FString cmd;
|
FString cmd;
|
||||||
cmd << "kdialog --title \"" GAMENAME " " << GetVersionString()
|
cmd << "kdialog --title \"" GAMENAME " " << GetVersionString()
|
||||||
<< "\" --msgbox \"" << errortext << "\"";
|
<< "\" --msgbox \"" << errortext << "\"";
|
||||||
popen(cmd, "r");
|
popen(cmd.GetChars(), "r");
|
||||||
}
|
}
|
||||||
#ifndef NO_GTK
|
#ifndef NO_GTK
|
||||||
else if (I_GtkAvailable())
|
else if (I_GtkAvailable())
|
||||||
|
@ -131,7 +131,7 @@ void Unix_I_FatalError(const char* errortext)
|
||||||
FString title;
|
FString title;
|
||||||
title << GAMENAME " " << GetVersionString();
|
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);
|
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)
|
for(i = 0; i < numwads; ++i)
|
||||||
{
|
{
|
||||||
const char *filepart = strrchr(wads[i].Path, '/');
|
const char *filepart = strrchr(wads[i].Path.GetChars(), '/');
|
||||||
if(filepart == NULL)
|
if(filepart == NULL)
|
||||||
filepart = wads[i].Path;
|
filepart = wads[i].Path.GetChars();
|
||||||
else
|
else
|
||||||
filepart++;
|
filepart++;
|
||||||
// Menu entries are specified in "tag" "item" pairs, where when a
|
// Menu entries are specified in "tag" "item" pairs, where when a
|
||||||
|
@ -329,15 +329,15 @@ int I_PickIWad (WadStuff *wads, int numwads, bool showwin, int defaultiwad, int&
|
||||||
|
|
||||||
if(defaultiwad >= 0 && defaultiwad < numwads)
|
if(defaultiwad >= 0 && defaultiwad < numwads)
|
||||||
{
|
{
|
||||||
const char *filepart = strrchr(wads[defaultiwad].Path, '/');
|
const char *filepart = strrchr(wads[defaultiwad].Path.GetChars(), '/');
|
||||||
if(filepart == NULL)
|
if(filepart == NULL)
|
||||||
filepart = wads[defaultiwad].Path;
|
filepart = wads[defaultiwad].Path.GetChars();
|
||||||
else
|
else
|
||||||
filepart++;
|
filepart++;
|
||||||
cmd.AppendFormat(" --default \"%s (%s)\"", wads[defaultiwad].Name.GetChars(), filepart);
|
cmd.AppendFormat(" --default \"%s (%s)\"", wads[defaultiwad].Name.GetChars(), filepart);
|
||||||
}
|
}
|
||||||
|
|
||||||
FILE *f = popen(cmd, "r");
|
FILE *f = popen(cmd.GetChars(), "r");
|
||||||
if(f != NULL)
|
if(f != NULL)
|
||||||
{
|
{
|
||||||
char gotstr[16];
|
char gotstr[16];
|
||||||
|
@ -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");
|
printf ("Please select a game wad (or 0 to exit):\n");
|
||||||
for (i = 0; i < numwads; ++i)
|
for (i = 0; i < numwads; ++i)
|
||||||
{
|
{
|
||||||
const char *filepart = strrchr (wads[i].Path, '/');
|
const char *filepart = strrchr (wads[i].Path.GetChars(), '/');
|
||||||
if (filepart == NULL)
|
if (filepart == NULL)
|
||||||
filepart = wads[i].Path;
|
filepart = wads[i].Path.GetChars();
|
||||||
else
|
else
|
||||||
filepart++;
|
filepart++;
|
||||||
printf ("%d. %s (%s)\n", i+1, wads[i].Name.GetChars(), filepart);
|
printf ("%d. %s (%s)\n", i+1, wads[i].Name.GetChars(), filepart);
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace Priv
|
||||||
caption.Format(GAMENAME " %s (%s)", GetVersionString(), GetGitTime());
|
caption.Format(GAMENAME " %s (%s)", GetVersionString(), GetGitTime());
|
||||||
|
|
||||||
const uint32_t windowFlags = (win_maximized ? SDL_WINDOW_MAXIMIZED : 0) | SDL_WINDOW_RESIZABLE | extraFlags;
|
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_x <= 0) ? SDL_WINDOWPOS_CENTERED_DISPLAY(vid_adapter) : win_x,
|
||||||
(win_y <= 0) ? SDL_WINDOWPOS_CENTERED_DISPLAY(vid_adapter) : win_y,
|
(win_y <= 0) ? SDL_WINDOWPOS_CENTERED_DISPLAY(vid_adapter) : win_y,
|
||||||
win_w, win_h, windowFlags);
|
win_w, win_h, windowFlags);
|
||||||
|
@ -585,7 +585,7 @@ void I_SetWindowTitle(const char* caption)
|
||||||
{
|
{
|
||||||
FString default_caption;
|
FString default_caption;
|
||||||
default_caption.Format(GAMENAME " %s (%s)", GetVersionString(), GetGitTime());
|
default_caption.Format(GAMENAME " %s (%s)", GetVersionString(), GetGitTime());
|
||||||
SDL_SetWindowTitle(Priv::window, default_caption);
|
SDL_SetWindowTitle(Priv::window, default_caption.GetChars());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,9 +292,9 @@ public:
|
||||||
store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
|
store = gtk_list_store_new (3, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_INT);
|
||||||
for (int i = 0; i < numwads; ++i)
|
for (int i = 0; i < numwads; ++i)
|
||||||
{
|
{
|
||||||
const char *filepart = strrchr (wads[i].Path, '/');
|
const char *filepart = strrchr (wads[i].Path.GetChars(), '/');
|
||||||
if (filepart == NULL)
|
if (filepart == NULL)
|
||||||
filepart = wads[i].Path;
|
filepart = wads[i].Path.GetChars();
|
||||||
else
|
else
|
||||||
filepart++;
|
filepart++;
|
||||||
gtk_list_store_append (store, &iter);
|
gtk_list_store_append (store, &iter);
|
||||||
|
|
|
@ -50,15 +50,15 @@ FString GetUserFile (const char *file)
|
||||||
|
|
||||||
path = NicePath("$HOME/" GAME_DIR "/");
|
path = NicePath("$HOME/" GAME_DIR "/");
|
||||||
|
|
||||||
if (stat (path, &info) == -1)
|
if (stat (path.GetChars(), &info) == -1)
|
||||||
{
|
{
|
||||||
struct stat extrainfo;
|
struct stat extrainfo;
|
||||||
|
|
||||||
// Sanity check for $HOME/.config
|
// Sanity check for $HOME/.config
|
||||||
FString configPath = NicePath("$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));
|
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
|
// Transfer the old zdoom directory to the new location
|
||||||
bool moved = false;
|
bool moved = false;
|
||||||
FString oldpath = NicePath("$HOME/." GAMENAMELOWERCASE "/");
|
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.GetChars()) == -1)
|
||||||
{
|
{
|
||||||
I_Error ("Failed to move old " GAMENAMELOWERCASE " directory (%s) to new location (%s).",
|
I_Error ("Failed to move old " GAMENAMELOWERCASE " directory (%s) to new location (%s).",
|
||||||
oldpath.GetChars(), path.GetChars());
|
oldpath.GetChars(), path.GetChars());
|
||||||
|
@ -83,7 +83,7 @@ FString GetUserFile (const char *file)
|
||||||
moved = true;
|
moved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!moved && mkdir (path, S_IRUSR | S_IWUSR | S_IXUSR) == -1)
|
if (!moved && mkdir (path.GetChars(), S_IRUSR | S_IWUSR | S_IXUSR) == -1)
|
||||||
{
|
{
|
||||||
I_FatalError ("Failed to create %s directory:\n%s",
|
I_FatalError ("Failed to create %s directory:\n%s",
|
||||||
path.GetChars(), strerror (errno));
|
path.GetChars(), strerror (errno));
|
||||||
|
@ -115,7 +115,7 @@ FString M_GetAppDataPath(bool create)
|
||||||
FString path = NicePath("$HOME/.config/" GAMENAMELOWERCASE);
|
FString path = NicePath("$HOME/.config/" GAMENAMELOWERCASE);
|
||||||
if (create)
|
if (create)
|
||||||
{
|
{
|
||||||
CreatePath(path);
|
CreatePath(path.GetChars());
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
@ -135,7 +135,7 @@ FString M_GetCachePath(bool create)
|
||||||
FString path = NicePath("$HOME/.config/zdoom/cache");
|
FString path = NicePath("$HOME/.config/zdoom/cache");
|
||||||
if (create)
|
if (create)
|
||||||
{
|
{
|
||||||
CreatePath(path);
|
CreatePath(path.GetChars());
|
||||||
}
|
}
|
||||||
return path;
|
return path;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue