mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-25 12:12:50 +01:00
Make fs::get_parent_dir/fs::pending_file use string_view as argument
This commit is contained in:
parent
ab5a33fc31
commit
149c593d89
@ -384,7 +384,7 @@ shared_ptr<fs::device_base> fs::set_virtual_device(const std::string& name, shar
|
|||||||
return get_device_manager().set_device(name, std::move(device));
|
return get_device_manager().set_device(name, std::move(device));
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string fs::get_parent_dir(const std::string& path, u32 levels)
|
std::string fs::get_parent_dir(std::string_view path, u32 levels)
|
||||||
{
|
{
|
||||||
std::string_view result = path;
|
std::string_view result = path;
|
||||||
|
|
||||||
@ -1981,11 +1981,11 @@ fs::file fs::make_gather(std::vector<fs::file> files)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
fs::pending_file::pending_file(const std::string& path)
|
fs::pending_file::pending_file(std::string_view path)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
m_path = fmt::format(u8"%s/$%s.%s.tmp", get_parent_dir(path), std::string_view(path).substr(path.find_last_of(fs::delim) + 1), fmt::base57(utils::get_unique_tsc()));
|
m_path = fmt::format(u8"%s/$%s.%s.tmp", get_parent_dir(path), path.substr(path.find_last_of(fs::delim) + 1), fmt::base57(utils::get_unique_tsc()));
|
||||||
|
|
||||||
if (file.open(m_path, fs::create + fs::write + fs::read + fs::excl))
|
if (file.open(m_path, fs::create + fs::write + fs::read + fs::excl))
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ namespace fs
|
|||||||
shared_ptr<device_base> set_virtual_device(const std::string& name, shared_ptr<device_base> device);
|
shared_ptr<device_base> set_virtual_device(const std::string& name, shared_ptr<device_base> device);
|
||||||
|
|
||||||
// Try to get parent directory (returns empty string on failure)
|
// Try to get parent directory (returns empty string on failure)
|
||||||
std::string get_parent_dir(const std::string& path, u32 levels = 1);
|
std::string get_parent_dir(std::string_view path, u32 levels = 1);
|
||||||
|
|
||||||
// Get file information
|
// Get file information
|
||||||
bool stat(const std::string& path, stat_t& info);
|
bool stat(const std::string& path, stat_t& info);
|
||||||
@ -637,7 +637,7 @@ namespace fs
|
|||||||
// This is meant to modify files atomically, overwriting is likely
|
// This is meant to modify files atomically, overwriting is likely
|
||||||
bool commit(bool overwrite = true);
|
bool commit(bool overwrite = true);
|
||||||
|
|
||||||
pending_file(const std::string& path);
|
pending_file(std::string_view path);
|
||||||
pending_file(const pending_file&) = delete;
|
pending_file(const pending_file&) = delete;
|
||||||
pending_file& operator=(const pending_file&) = delete;
|
pending_file& operator=(const pending_file&) = delete;
|
||||||
~pending_file();
|
~pending_file();
|
||||||
|
Loading…
Reference in New Issue
Block a user