From c4a668ffe2c3e37e3abb9a8691f0a36346c33835 Mon Sep 17 00:00:00 2001 From: Gary Talent Date: Sat, 30 Mar 2019 17:13:56 -0500 Subject: [PATCH] [ox/fs] Add base path access to PassthroughFS (synced from 05c0eb2f78af886f5190cda5a490d38ba2d652dd) --- src/ox/fs/filesystem/directory.hpp | 2 +- src/ox/fs/filesystem/passthroughfs.cpp | 4 ++++ src/ox/fs/filesystem/passthroughfs.hpp | 3 +++ src/ox/fs/filesystem/types.hpp | 2 +- 4 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ox/fs/filesystem/directory.hpp b/src/ox/fs/filesystem/directory.hpp index 94a4891df..28340d6b6 100644 --- a/src/ox/fs/filesystem/directory.hpp +++ b/src/ox/fs/filesystem/directory.hpp @@ -11,7 +11,7 @@ #include #include #include -#include +#include namespace ox { diff --git a/src/ox/fs/filesystem/passthroughfs.cpp b/src/ox/fs/filesystem/passthroughfs.cpp index 092980bd1..e34bd0cc8 100644 --- a/src/ox/fs/filesystem/passthroughfs.cpp +++ b/src/ox/fs/filesystem/passthroughfs.cpp @@ -21,6 +21,10 @@ PassThroughFS::PassThroughFS(const char *dirPath) { PassThroughFS::~PassThroughFS() { } +std::string PassThroughFS::basePath() { + return m_path.string(); +} + Error PassThroughFS::mkdir(const char *path, bool recursive) { bool success = false; const auto p = m_path / stripSlash(path); diff --git a/src/ox/fs/filesystem/passthroughfs.hpp b/src/ox/fs/filesystem/passthroughfs.hpp index 712222ce8..fee21ca8f 100644 --- a/src/ox/fs/filesystem/passthroughfs.hpp +++ b/src/ox/fs/filesystem/passthroughfs.hpp @@ -11,6 +11,7 @@ #if __has_include() #include +#include #include "filesystem.hpp" @@ -28,6 +29,8 @@ class PassThroughFS: public FileSystem { ~PassThroughFS(); + [[nodiscard]] std::string basePath(); + Error mkdir(const char *path, bool recursive = false) override; Error move(const char *src, const char *dest) override; diff --git a/src/ox/fs/filesystem/types.hpp b/src/ox/fs/filesystem/types.hpp index 3f526b9a2..aaf27efec 100644 --- a/src/ox/fs/filesystem/types.hpp +++ b/src/ox/fs/filesystem/types.hpp @@ -8,7 +8,7 @@ #pragma once -#include +#include namespace ox {