Deprecated FileSystemAdapter::getHomeFolder().
This commit is contained in:
parent
e35f5a35f8
commit
d7f968db3a
@ -35,6 +35,7 @@ namespace mijin
|
||||
struct FileInfo
|
||||
{
|
||||
fs::path path;
|
||||
/// either file size in bytes, or number of entries if folder
|
||||
std::size_t size = 0;
|
||||
bool exists : 1 = false;
|
||||
bool isFolder : 1 = false;
|
||||
@ -79,7 +80,8 @@ class FileSystemAdapter
|
||||
public:
|
||||
virtual ~FileSystemAdapter() = default;
|
||||
|
||||
[[nodiscard]] virtual fs::path getHomeFolder() = 0;
|
||||
[[deprecated("Will be removed ASAP")]]
|
||||
[[nodiscard]] virtual fs::path getHomeFolder() { return {}; } // TODO: get rid of this ...
|
||||
[[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; }
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#include "./stacked.hpp"
|
||||
|
||||
#include <algorithm>
|
||||
#include "../detect.hpp"
|
||||
|
||||
namespace mijin
|
||||
{
|
||||
@ -35,7 +36,14 @@ fs::path StackedFileSystemAdapter::getHomeFolder()
|
||||
if (adapters_.empty()) {
|
||||
return fs::path();
|
||||
}
|
||||
#if MIJIN_COMPILER == MIJIN_COMPILER_MSVC
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable : 4996) // yeah, we're using a deprecated function here, in order to implement another deprecated function ¯\_(ツ)_/¯
|
||||
#endif
|
||||
return adapters_.front()->getHomeFolder();
|
||||
#if MIJIN_COMPILER == MIJIN_COMPILER_MSVC
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
}
|
||||
|
||||
std::vector<FileInfo> StackedFileSystemAdapter::listFiles(const fs::path& folder)
|
||||
|
||||
@ -36,12 +36,13 @@ public:
|
||||
void getAllPaths(const fs::path &path, std::vector<PathReference> &outPaths) override;
|
||||
using FileSystemAdapter::getAllPaths;
|
||||
|
||||
inline void addAdapter(std::unique_ptr<FileSystemAdapter>&& adapter) {
|
||||
inline FileSystemAdapter* addAdapter(std::unique_ptr<FileSystemAdapter>&& adapter) {
|
||||
adapters_.push_back(std::move(adapter));
|
||||
return adapters_.back().get();
|
||||
}
|
||||
template<typename TAdapter, typename... TArgs>
|
||||
inline void emplaceAdapter(TArgs&&... args) {
|
||||
addAdapter(std::make_unique<TAdapter>(std::forward<TArgs>(args)...));
|
||||
inline TAdapter* emplaceAdapter(TArgs&&... args) {
|
||||
return static_cast<TAdapter*>(addAdapter(std::make_unique<TAdapter>(std::forward<TArgs>(args)...)));
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user