mirror of
https://foundry.openuru.org/gitblit/r/CWE-ou-minkata.git
synced 2025-07-18 11:19:10 +00:00
Remove plFileSystem::GetTempFileName.
It was unused and on *nix used the deprecated mktemp function.
This commit is contained in:
@ -540,37 +540,6 @@ plFileName plFileSystem::GetCurrentAppPath()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
plFileName plFileSystem::GetTempFilename(const char *prefix, const plFileName &path)
|
|
||||||
{
|
|
||||||
#if HS_BUILD_FOR_WIN32
|
|
||||||
// GetTempFileName() never uses more than 3 chars for the prefix
|
|
||||||
wchar_t wprefix[4];
|
|
||||||
for (size_t i=0; i<4; ++i)
|
|
||||||
wprefix[i] = prefix[i];
|
|
||||||
wprefix[3] = 0;
|
|
||||||
|
|
||||||
wchar_t temp[MAX_PATH];
|
|
||||||
if (GetTempFileNameW(path.AsString().ToWchar(), wprefix, 0, temp))
|
|
||||||
return plString::FromWchar(temp);
|
|
||||||
|
|
||||||
return "";
|
|
||||||
#else
|
|
||||||
plFileName tmpdir = path;
|
|
||||||
if (!tmpdir.IsValid())
|
|
||||||
tmpdir = "/tmp";
|
|
||||||
|
|
||||||
// "/tmp/prefixXXXXXX"
|
|
||||||
size_t temp_len = tmpdir.GetSize() + strlen(prefix) + 7;
|
|
||||||
char *temp = new char[temp_len + 1];
|
|
||||||
snprintf(temp, temp_len + 1, "%s/%sXXXXXX", tmpdir.AsString().c_str(), prefix);
|
|
||||||
mktemp(temp);
|
|
||||||
plFileName result = temp;
|
|
||||||
delete [] temp;
|
|
||||||
|
|
||||||
return result;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
plString plFileSystem::ConvertFileSize(uint64_t size)
|
plString plFileSystem::ConvertFileSize(uint64_t size)
|
||||||
{
|
{
|
||||||
const char* labels[] = { "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" };
|
const char* labels[] = { "KiB", "MiB", "GiB", "TiB", "PiB", "EiB" };
|
||||||
|
@ -333,12 +333,6 @@ namespace plFileSystem
|
|||||||
/** Get the full path and filename of the current process. */
|
/** Get the full path and filename of the current process. */
|
||||||
plFileName GetCurrentAppPath();
|
plFileName GetCurrentAppPath();
|
||||||
|
|
||||||
/** Create a temporary filename. If path is specified, the returned
|
|
||||||
* filename will be relative to the supplied path -- otherwise, the
|
|
||||||
* system temp path is used.
|
|
||||||
*/
|
|
||||||
plFileName GetTempFilename(const char *prefix = "tmp", const plFileName &path = "");
|
|
||||||
|
|
||||||
/** Convert a file size from bytes to a human readable size. */
|
/** Convert a file size from bytes to a human readable size. */
|
||||||
plString ConvertFileSize(uint64_t size);
|
plString ConvertFileSize(uint64_t size);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user