2016-04-14 00:59:00 +02:00
|
|
|
#pragma once
|
|
|
|
|
|
2018-09-11 18:02:19 +02:00
|
|
|
#include <vector>
|
2017-08-15 14:03:07 +02:00
|
|
|
#include <string>
|
2018-09-11 18:02:19 +02:00
|
|
|
#include <string_view>
|
2017-08-15 14:03:07 +02:00
|
|
|
|
2016-04-14 00:59:00 +02:00
|
|
|
namespace vfs
|
|
|
|
|
{
|
2016-06-02 17:16:01 +02:00
|
|
|
// Mount VFS device
|
2018-09-11 18:02:19 +02:00
|
|
|
bool mount(std::string_view vpath, std::string_view path);
|
2016-06-02 17:16:01 +02:00
|
|
|
|
2018-09-11 18:02:19 +02:00
|
|
|
// Convert VFS path to fs path, optionally listing directories mounted in it
|
|
|
|
|
std::string get(std::string_view vpath, std::vector<std::string>* out_dir = nullptr);
|
2017-10-11 02:19:32 +02:00
|
|
|
|
|
|
|
|
// Escape VFS path by replacing non-portable characters with surrogates
|
2018-09-11 18:02:19 +02:00
|
|
|
std::string escape(std::string_view path);
|
2017-10-11 02:19:32 +02:00
|
|
|
|
|
|
|
|
// Invert escape operation
|
2018-09-11 18:02:19 +02:00
|
|
|
std::string unescape(std::string_view path);
|
2019-04-07 11:58:08 +02:00
|
|
|
|
|
|
|
|
// Functions in this namespace operate on host filepaths, similar to fs::
|
|
|
|
|
namespace host
|
|
|
|
|
{
|
|
|
|
|
// Call fs::rename with retry on access error
|
|
|
|
|
bool rename(const std::string& from, const std::string& to, bool overwrite);
|
2019-04-07 23:53:56 +02:00
|
|
|
|
|
|
|
|
// Delete file without deleting its contents, emulated with MoveFileEx on Windows
|
|
|
|
|
bool unlink(const std::string&);
|
2019-04-07 11:58:08 +02:00
|
|
|
}
|
2016-04-14 00:59:00 +02:00
|
|
|
}
|