mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-28 13:28:01 +03:00
fs: implement fs::get_temp_dir() (Win32)
Trying to workaround issues with sparse files (#10231)
This commit is contained in:
parent
546b52200b
commit
e24ada37bf
3 changed files with 31 additions and 2 deletions
|
@ -1729,6 +1729,32 @@ const std::string& fs::get_cache_dir()
|
|||
return s_dir;
|
||||
}
|
||||
|
||||
const std::string& fs::get_temp_dir()
|
||||
{
|
||||
static const std::string s_dir = []
|
||||
{
|
||||
std::string dir;
|
||||
|
||||
#ifdef _WIN32
|
||||
wchar_t buf[MAX_PATH + 2]{};
|
||||
if (GetTempPathW(MAX_PATH + 1, buf) - 1 > MAX_PATH)
|
||||
{
|
||||
MessageBoxA(nullptr, fmt::format("GetTempPath() failed: error %u.", GetLastError()).c_str(), "fs::get_temp_dir()", MB_ICONERROR);
|
||||
return dir; // empty
|
||||
}
|
||||
|
||||
to_utf8(dir, buf);
|
||||
#else
|
||||
// TODO
|
||||
dir = get_cache_dir();
|
||||
#endif
|
||||
|
||||
return dir;
|
||||
}();
|
||||
|
||||
return s_dir;
|
||||
}
|
||||
|
||||
bool fs::remove_all(const std::string& path, bool remove_root)
|
||||
{
|
||||
if (const auto root_dir = dir(path))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue