Added getNativePath() method to get the OS version of a virtual path.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../container/optional.hpp"
|
||||
#include "../io/stream.hpp"
|
||||
#include "../util/hash.hpp"
|
||||
|
||||
@@ -62,6 +63,7 @@ public:
|
||||
[[nodiscard]] class FileSystemAdapter* getAdapter() const noexcept { return adapter_; }
|
||||
[[nodiscard]] const fs::path& getPath() const noexcept { return path_; }
|
||||
[[nodiscard]] inline FileInfo getInfo() const;
|
||||
[[nodiscard]] inline Optional<fs::path> getNativePath() const;
|
||||
[[nodiscard]] inline StreamError open(FileOpenMode mode, std::unique_ptr<Stream>& outStream) const;
|
||||
};
|
||||
|
||||
@@ -74,6 +76,7 @@ public:
|
||||
[[nodiscard]] virtual fs::path getHomeFolder() = 0;
|
||||
[[nodiscard]] virtual std::vector<FileInfo> listFiles(const fs::path& folder) = 0;
|
||||
[[nodiscard]] virtual FileInfo getFileInfo(const fs::path& file) = 0;
|
||||
[[nodiscard]] virtual Optional<fs::path> getNativePath(const fs::path& /* file */) { return NULL_OPTIONAL; }
|
||||
[[nodiscard]] virtual StreamError open(const fs::path& path, FileOpenMode mode, std::unique_ptr<Stream>& outStream) = 0;
|
||||
|
||||
[[nodiscard]] PathReference getPath(fs::path path) noexcept { return PathReference(this, std::move(path)); }
|
||||
@@ -86,6 +89,7 @@ public:
|
||||
fs::path getHomeFolder() override;
|
||||
std::vector<FileInfo> listFiles(const fs::path& folder) override;
|
||||
FileInfo getFileInfo(const fs::path& file) override;
|
||||
Optional<fs::path> getNativePath(const fs::path& file) override;
|
||||
StreamError open(const fs::path& path, FileOpenMode mode, std::unique_ptr<Stream>& outStream) override;
|
||||
|
||||
static OSFileSystemAdapter& getInstance();
|
||||
@@ -100,6 +104,11 @@ inline FileInfo PathReference::getInfo() const
|
||||
return adapter_->getFileInfo(path_);
|
||||
}
|
||||
|
||||
Optional<fs::path> PathReference::getNativePath() const
|
||||
{
|
||||
return adapter_->getNativePath(path_);
|
||||
}
|
||||
|
||||
inline StreamError PathReference::open(FileOpenMode mode, std::unique_ptr<Stream>& outStream) const
|
||||
{
|
||||
return adapter_->open(path_, mode, outStream);
|
||||
|
||||
Reference in New Issue
Block a user