diff --git a/.gitmodules b/.gitmodules index 57fff4d4..2838372b 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,6 @@ [submodule "dep/fuzzysearchdatabase"] path = dep/fuzzysearchdatabase url = https://bitbucket.org/j_norberg/fuzzysearchdatabase.git +[submodule "dep/filesystem"] + path = dep/filesystem + url = https://github.com/gulrak/filesystem.git diff --git a/dep/Makefile b/dep/Makefile index 7244b0d0..7929cdb8 100755 --- a/dep/Makefile +++ b/dep/Makefile @@ -54,6 +54,7 @@ oui-blendish = include/blendish.h osdialog = include/osdialog.h pffft = include/pffft.h fuzzysearchdatabase = include/FuzzySearchDatabase.hpp +ghcfilesystem = include/ghc/filesystem.hpp DEPS += $(glew) DEPS += $(glfw) @@ -70,6 +71,7 @@ DEPS += $(oui-blendish) DEPS += $(osdialog) DEPS += $(pffft) DEPS += $(fuzzysearchdatabase) +DEPS += $(ghcfilesystem) DEP_LOCAL := . @@ -250,6 +252,10 @@ $(fuzzysearchdatabase): fuzzysearchdatabase/src/FuzzySearchDatabase.hpp mkdir -p include cp $^ include/ +$(ghcfilesystem): filesystem/include/ghc + mkdir -p include + cp -r $^ include/ + # Helpers src: glew-2.1.0 glfw jansson-2.12 speexdsp-SpeexDSP-1.2rc3 openssl-1.1.1d curl-7.66.0 zstd-1.4.5 libarchive-3.4.3 rtmidi-4.0.0 rtaudio nanovg nanosvg oui-blendish osdialog pffft diff --git a/dep/filesystem b/dep/filesystem new file mode 160000 index 00000000..7e37433f --- /dev/null +++ b/dep/filesystem @@ -0,0 +1 @@ +Subproject commit 7e37433f318488ae4bc80f80e12df12a01579874 diff --git a/src/system.cpp b/src/system.cpp index b0a728a6..6a0fcddb 100644 --- a/src/system.cpp +++ b/src/system.cpp @@ -1,7 +1,7 @@ #include #include #include -#include +#include #include #include @@ -43,7 +43,7 @@ Important: When using `fs::path`, always convert strings to UTF-8 using In fact, it's best to work only with strings to avoid forgetting to decode a string as UTF-8. The need to do this is a fatal flaw of `fs::path`, but at least `std::filesystem` has some helpful operations. */ -namespace fs = std::experimental::filesystem; +namespace fs = ghc::filesystem; namespace rack { @@ -415,7 +415,7 @@ void unarchiveToFolder(const std::string& archivePath, const std::string& folder std::string entryPath = archive_entry_pathname(entry); if (!fs::u8path(entryPath).is_relative()) throw Exception(string::f("Unarchiver does not support absolute tar paths: %s", entryPath.c_str())); - entryPath = fs::absolute(fs::u8path(entryPath), fs::u8path(folderPath)).generic_u8string(); + entryPath = fs::relative(fs::u8path(entryPath), fs::u8path(folderPath)).generic_u8string(); #if defined ARCH_WIN archive_entry_copy_pathname_w(entry, string::U8toU16(entryPath).c_str()); #else