mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-22 20:21:26 +00:00
- return a std::string from GetFileFullPath
This commit is contained in:
parent
25b7b18c3d
commit
8a5d3c096b
11 changed files with 21 additions and 21 deletions
|
@ -203,7 +203,7 @@ void FScanner :: OpenLumpNum (int lump)
|
|||
FileData mem = fileSystem.ReadFile(lump);
|
||||
ScriptBuffer = mem.GetString();
|
||||
}
|
||||
ScriptName = fileSystem.GetFileFullPath(lump);
|
||||
ScriptName = fileSystem.GetFileFullPath(lump).c_str();
|
||||
LumpNum = lump;
|
||||
PrepareScript ();
|
||||
}
|
||||
|
|
|
@ -1130,13 +1130,15 @@ const char *FileSystem::GetFileFullName (int lump, bool returnshort) const
|
|||
//
|
||||
//==========================================================================
|
||||
|
||||
FString FileSystem::GetFileFullPath(int lump) const
|
||||
std::string FileSystem::GetFileFullPath(int lump) const
|
||||
{
|
||||
FString foo;
|
||||
std::string foo;
|
||||
|
||||
if ((size_t) lump < NumEntries)
|
||||
{
|
||||
foo << GetResourceFileName(FileInfo[lump].rfnum) << ':' << GetFileFullName(lump);
|
||||
foo = GetResourceFileName(FileInfo[lump].rfnum);
|
||||
foo += ':';
|
||||
foo += +GetFileFullName(lump);
|
||||
}
|
||||
return foo;
|
||||
}
|
||||
|
|
|
@ -138,7 +138,7 @@ public:
|
|||
int GetFileFlags (int lump); // Return the flags for this lump
|
||||
const char* GetFileShortName(int lump) const;
|
||||
const char *GetFileFullName (int lump, bool returnshort = true) const; // [RH] Returns the lump's full name
|
||||
FString GetFileFullPath (int lump) const; // [RH] Returns wad's name + lump's full name
|
||||
std::string GetFileFullPath (int lump) const; // [RH] Returns wad's name + lump's full name
|
||||
int GetFileContainer (int lump) const; // [RH] Returns wadnum for a specified lump
|
||||
int GetFileNamespace (int lump) const; // [RH] Returns the namespace a lump belongs to
|
||||
void SetFileNamespace(int lump, int ns);
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
*/
|
||||
bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length)
|
||||
{
|
||||
FString objName = fileSystem.GetFileFullPath(lumpnum);
|
||||
auto objName = fileSystem.GetFileFullPath(lumpnum);
|
||||
FString objBuf(buffer, length);
|
||||
|
||||
// Do some replacements before we parse the OBJ string
|
||||
|
@ -101,7 +101,7 @@ bool FOBJModel::Load(const char* fn, int lumpnum, const char* buffer, int length
|
|||
wObjBuf = nullptr;
|
||||
objBuf.UnlockBuffer();
|
||||
}
|
||||
sc.OpenString(objName, objBuf);
|
||||
sc.OpenString(objName.c_str(), objBuf);
|
||||
|
||||
FTextureID curMtl = FNullTextureID();
|
||||
OBJSurface *curSurface = nullptr;
|
||||
|
|
|
@ -407,8 +407,6 @@ PNamespace *ParseOneScript(const int baselump, ZCCParseState &state)
|
|||
int lumpnum = baselump;
|
||||
auto fileno = fileSystem.GetFileContainer(lumpnum);
|
||||
|
||||
FString file = fileSystem.GetFileFullPath(lumpnum);
|
||||
|
||||
state.FileNo = fileno;
|
||||
|
||||
if (TokenMap.CountUsed() == 0)
|
||||
|
@ -503,7 +501,7 @@ PNamespace *ParseOneScript(const int baselump, ZCCParseState &state)
|
|||
// If the parser fails, there is no point starting the compiler, because it'd only flood the output with endless errors.
|
||||
if (FScriptPosition::ErrorCounter > 0)
|
||||
{
|
||||
I_Error("%d errors while parsing %s", FScriptPosition::ErrorCounter, fileSystem.GetFileFullPath(baselump).GetChars());
|
||||
I_Error("%d errors while parsing %s", FScriptPosition::ErrorCounter, fileSystem.GetFileFullPath(baselump).c_str());
|
||||
}
|
||||
|
||||
#ifndef NDEBUG
|
||||
|
@ -517,7 +515,7 @@ PNamespace *ParseOneScript(const int baselump, ZCCParseState &state)
|
|||
if (Args->CheckParm("-dumpast"))
|
||||
{
|
||||
FString ast = ZCC_PrintAST(state.TopNode);
|
||||
FString filename = fileSystem.GetFileFullPath(baselump);
|
||||
FString filename = fileSystem.GetFileFullPath(baselump).c_str();
|
||||
filename.ReplaceChars(":\\/?|", '.');
|
||||
filename << ".ast";
|
||||
FileWriter *ff = FileWriter::Open(filename);
|
||||
|
|
|
@ -287,7 +287,7 @@ PalettedPixels FJPEGTexture::CreatePalettedPixels(int conversion)
|
|||
(cinfo.out_color_space == JCS_YCbCr && cinfo.num_components == 3) ||
|
||||
(cinfo.out_color_space == JCS_GRAYSCALE && cinfo.num_components == 1)))
|
||||
{
|
||||
Printf(TEXTCOLOR_ORANGE "Unsupported color format in %s\n", fileSystem.GetFileFullPath(SourceLump).GetChars());
|
||||
Printf(TEXTCOLOR_ORANGE "Unsupported color format in %s\n", fileSystem.GetFileFullPath(SourceLump).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -382,7 +382,7 @@ PalettedPixels FJPEGTexture::CreatePalettedPixels(int conversion)
|
|||
}
|
||||
catch (int)
|
||||
{
|
||||
Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", fileSystem.GetFileFullPath(SourceLump).GetChars());
|
||||
Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", fileSystem.GetFileFullPath(SourceLump).c_str());
|
||||
}
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
if (buff != NULL)
|
||||
|
@ -426,7 +426,7 @@ int FJPEGTexture::CopyPixels(FBitmap *bmp, int conversion)
|
|||
(cinfo.out_color_space == JCS_YCbCr && cinfo.num_components == 3) ||
|
||||
(cinfo.out_color_space == JCS_GRAYSCALE && cinfo.num_components == 1)))
|
||||
{
|
||||
Printf(TEXTCOLOR_ORANGE "Unsupported color format in %s\n", fileSystem.GetFileFullPath(SourceLump).GetChars());
|
||||
Printf(TEXTCOLOR_ORANGE "Unsupported color format in %s\n", fileSystem.GetFileFullPath(SourceLump).c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -479,7 +479,7 @@ int FJPEGTexture::CopyPixels(FBitmap *bmp, int conversion)
|
|||
}
|
||||
catch (int)
|
||||
{
|
||||
Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", fileSystem.GetFileFullPath(SourceLump).GetChars());
|
||||
Printf(TEXTCOLOR_ORANGE "JPEG error in %s\n", fileSystem.GetFileFullPath(SourceLump).c_str());
|
||||
}
|
||||
jpeg_destroy_decompress(&cinfo);
|
||||
return 0;
|
||||
|
|
|
@ -485,7 +485,7 @@ FTextureID FTextureManager::CreateTexture (int lumpnum, ETextureType usetype)
|
|||
}
|
||||
else
|
||||
{
|
||||
Printf (TEXTCOLOR_ORANGE "Invalid data encountered for texture %s\n", fileSystem.GetFileFullPath(lumpnum).GetChars());
|
||||
Printf (TEXTCOLOR_ORANGE "Invalid data encountered for texture %s\n", fileSystem.GetFileFullPath(lumpnum).c_str());
|
||||
return FTextureID(-1);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3004,7 +3004,7 @@ bool D_LoadDehLump(int lumpnum)
|
|||
|
||||
PatchSize = fileSystem.FileLength(lumpnum);
|
||||
|
||||
PatchName = fileSystem.GetFileFullPath(lumpnum);
|
||||
PatchName = fileSystem.GetFileFullPath(lumpnum).c_str();
|
||||
PatchFile = new char[PatchSize + 1];
|
||||
fileSystem.ReadFile(lumpnum, PatchFile);
|
||||
PatchFile[PatchSize] = '\0'; // terminate with a '\0' character
|
||||
|
|
|
@ -1001,7 +1001,7 @@ typedef TArray<uint8_t> MemFile;
|
|||
static FString CreateCacheName(MapData *map, bool create)
|
||||
{
|
||||
FString path = M_GetCachePath(create);
|
||||
FString lumpname = fileSystem.GetFileFullPath(map->lumpnum);
|
||||
FString lumpname = fileSystem.GetFileFullPath(map->lumpnum).c_str();
|
||||
auto separator = lumpname.IndexOf(':');
|
||||
path << '/' << lumpname.Left(separator);
|
||||
if (create) CreatePath(path);
|
||||
|
|
|
@ -1129,7 +1129,7 @@ static PClassActor *ParseActorHeader(FScanner &sc, Baggage *bag)
|
|||
{
|
||||
PClassActor *info = CreateNewActor(sc, typeName, parentName);
|
||||
info->ActorInfo()->DoomEdNum = DoomEdNum > 0 ? DoomEdNum : -1;
|
||||
info->SourceLumpName = fileSystem.GetFileFullPath(sc.LumpNum);
|
||||
info->SourceLumpName = fileSystem.GetFileFullPath(sc.LumpNum).c_str();
|
||||
|
||||
if (!info->SetReplacement(replaceName))
|
||||
{
|
||||
|
|
|
@ -433,12 +433,12 @@ void ParseScripts()
|
|||
if (FScriptPosition::ErrorCounter > 0)
|
||||
{
|
||||
// Abort if the compiler produced any errors. Also do not compile further lumps, because they very likely miss some stuff.
|
||||
I_Error("%d errors, %d warnings while compiling %s", FScriptPosition::ErrorCounter, FScriptPosition::WarnCounter, fileSystem.GetFileFullPath(lump).GetChars());
|
||||
I_Error("%d errors, %d warnings while compiling %s", FScriptPosition::ErrorCounter, FScriptPosition::WarnCounter, fileSystem.GetFileFullPath(lump).c_str());
|
||||
}
|
||||
else if (FScriptPosition::WarnCounter > 0)
|
||||
{
|
||||
// If we got warnings, but no errors, print the information but continue.
|
||||
Printf(TEXTCOLOR_ORANGE "%d warnings while compiling %s\n", FScriptPosition::WarnCounter, fileSystem.GetFileFullPath(lump).GetChars());
|
||||
Printf(TEXTCOLOR_ORANGE "%d warnings while compiling %s\n", FScriptPosition::WarnCounter, fileSystem.GetFileFullPath(lump).c_str());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue