Change ReadAll/WriteAll to take rdcstr instead of char* filename

This commit is contained in:
baldurk
2020-03-31 11:58:13 +01:00
parent bfeb66d4ce
commit fbe2d1fbee
4 changed files with 17 additions and 17 deletions
+1 -1
View File
@@ -146,7 +146,7 @@ bool AddManifestToAPK(const rdcstr &apk, const rdcstr &tmpDir, const bytebuf &ma
rdcstr aapt = getToolPath(ToolDir::BuildTools, "aapt", false);
// write the manifest to disk
FileIO::WriteAll((tmpDir + "AndroidManifest.xml").c_str(), manifest);
FileIO::WriteAll(tmpDir + "AndroidManifest.xml", manifest);
// run aapt to add the manifest
Process::ProcessResult result =
+1 -1
View File
@@ -275,7 +275,7 @@ void rdclog_filename(const char *filename)
if(logfileHandle && previous.c_str())
{
rdcstr previousContents;
FileIO::ReadAll(previous.c_str(), previousContents);
FileIO::ReadAll(previous, previousContents);
if(!previousContents.empty())
FileIO::logfile_append(logfileHandle, previousContents.c_str(), previousContents.size());
+7 -7
View File
@@ -188,7 +188,7 @@ rdcstr DisassembleSPIRV(ShaderStage stage, const bytebuf &shaderBytes, const rdc
tempPath.c_str(), stageName, tempPath.c_str(), stageName, tempPath.c_str(), stageName,
tempPath.c_str(), stageName, tempPath.c_str(), tempPath.c_str());
FileIO::WriteAll(inPath.c_str(), shaderBytes);
FileIO::WriteAll(inPath, shaderBytes);
// try to locate the amdspv relative to our running program
rdcstr amdspv = LocatePluginFile(pluginPath, amdspv_name);
@@ -210,18 +210,18 @@ rdcstr DisassembleSPIRV(ShaderStage stage, const bytebuf &shaderBytes, const rdc
if(amdil)
{
FileIO::ReadAll(StringFormat::Fmt("%sout.il", tempPath.c_str()).c_str(), ret);
FileIO::ReadAll(StringFormat::Fmt("%sout.il", tempPath.c_str()), ret);
}
else
{
FileIO::ReadAll(StringFormat::Fmt("%sout.txt", tempPath.c_str()).c_str(), ret);
FileIO::ReadAll(StringFormat::Fmt("%sout.txt", tempPath.c_str()), ret);
rdcstr statsfile = StringFormat::Fmt("%sstats.txt", tempPath.c_str());
if(FileIO::exists(statsfile.c_str()))
{
rdcstr stats;
FileIO::ReadAll(statsfile.c_str(), stats);
FileIO::ReadAll(statsfile, stats);
ret += "\n\n" + stats;
}
@@ -359,7 +359,7 @@ rdcstr DisassembleGLSL(ShaderStage stage, const bytebuf &shaderBytes, const rdcs
if(!found)
return "; Invalid ISA Target specified";
FileIO::WriteAll(inPath.c_str(), shaderBytes);
FileIO::WriteAll(inPath, shaderBytes);
// try to locate the amdspv relative to our running program
rdcstr vc = LocatePluginFile(pluginPath, virtualcontext_name);
@@ -380,7 +380,7 @@ rdcstr DisassembleGLSL(ShaderStage stage, const bytebuf &shaderBytes, const rdcs
rdcstr ret;
{
FileIO::ReadAll(outPath.c_str(), ret);
FileIO::ReadAll(outPath, ret);
while(ret.back() == '\0')
ret.pop_back();
@@ -388,7 +388,7 @@ rdcstr DisassembleGLSL(ShaderStage stage, const bytebuf &shaderBytes, const rdcs
if(FileIO::exists(statsPath.c_str()))
{
rdcstr stats;
FileIO::ReadAll(statsPath.c_str(), stats);
FileIO::ReadAll(statsPath, stats);
ret += "\n\n" + stats;
}
}
+8 -8
View File
@@ -330,9 +330,9 @@ void logfile_close(LogFileHandle *logHandle, const char *deleteFilename);
rdcstr logfile_readall(const char *filename);
// utility functions
inline bool WriteAll(const char *filename, const void *buffer, size_t size)
inline bool WriteAll(const rdcstr &filename, const void *buffer, size_t size)
{
FILE *f = FileIO::fopen(filename, "wb");
FILE *f = FileIO::fopen(filename.c_str(), "wb");
if(f == NULL)
return false;
@@ -344,21 +344,21 @@ inline bool WriteAll(const char *filename, const void *buffer, size_t size)
}
template <typename T>
bool WriteAll(const char *filename, const rdcarray<T> &buffer)
bool WriteAll(const rdcstr &filename, const rdcarray<T> &buffer)
{
return WriteAll(filename, buffer.data(), buffer.size() * sizeof(T));
}
template <typename T>
bool WriteAll(const char *filename, const rdcstr &buffer)
bool WriteAll(const rdcstr &filename, const rdcstr &buffer)
{
return WriteAll(filename, buffer.c_str(), buffer.length());
}
template <typename T>
bool ReadAll(const char *filename, rdcarray<T> &buffer)
bool ReadAll(const rdcstr &filename, rdcarray<T> &buffer)
{
FILE *f = FileIO::fopen(filename, "rb");
FILE *f = FileIO::fopen(filename.c_str(), "rb");
if(f == NULL)
return false;
@@ -375,9 +375,9 @@ bool ReadAll(const char *filename, rdcarray<T> &buffer)
return numRead == buffer.size();
}
inline bool ReadAll(const char *filename, rdcstr &str)
inline bool ReadAll(const rdcstr &filename, rdcstr &str)
{
FILE *f = FileIO::fopen(filename, "rb");
FILE *f = FileIO::fopen(filename.c_str(), "rb");
if(f == NULL)
return false;