diff --git a/plugins/common/plugin/NativeHelpers.cpp b/plugins/common/plugin/NativeHelpers.cpp index 8300fffa..d9517fb6 100644 --- a/plugins/common/plugin/NativeHelpers.cpp +++ b/plugins/common/plugin/NativeHelpers.cpp @@ -14,10 +14,11 @@ #if defined(_WIN32) -const fs::path toPlatformAgnosticPath(std::string& filePath) +const fs::path toPlatformAgnosticPath(const std::string& filePath) { - std::replace(filePath.begin(), filePath.end(), '\\', '/'); - return fs::u8path(filePath); + std::string p { filePath }; + std::replace(p.begin(), p.end(), '\\', '/'); + return fs::u8path(p); } const fs::path fromPlatformAgnosticPath(const char *filePath) { @@ -26,7 +27,7 @@ const fs::path fromPlatformAgnosticPath(const char *filePath) return fs::u8path(p); } #else -const fs::path toPlatformAgnosticPath(std::string& filePath) +const fs::path toPlatformAgnosticPath(const std::string& filePath) { return fs::u8path(filePath); } diff --git a/plugins/common/plugin/NativeHelpers.h b/plugins/common/plugin/NativeHelpers.h index d031dcb2..3bac9d33 100644 --- a/plugins/common/plugin/NativeHelpers.h +++ b/plugins/common/plugin/NativeHelpers.h @@ -13,7 +13,7 @@ const fs::path& getUserDocumentsDirectory(); -const fs::path toPlatformAgnosticPath(std::string& filePath); +const fs::path toPlatformAgnosticPath(const std::string& filePath); const fs::path fromPlatformAgnosticPath(const char *filePath); #if !defined(_WIN32) && !defined(__APPLE__) diff --git a/plugins/vst/SfizzVstState.cpp b/plugins/vst/SfizzVstState.cpp index 11080156..e31064f5 100644 --- a/plugins/vst/SfizzVstState.cpp +++ b/plugins/vst/SfizzVstState.cpp @@ -122,7 +122,7 @@ tresult SfizzVstState::store(IBStream* state) const if (!s.writeInt64u(currentStateVersion)) return kResultFalse; - if (!s.writeStr8(sfzFile.c_str())) + if (!s.writeStr8(toPlatformAgnosticPath(sfzFile).string().c_str())) return kResultFalse; if (!s.writeFloat(volume)) @@ -137,7 +137,7 @@ tresult SfizzVstState::store(IBStream* state) const if (!s.writeInt32(preloadSize)) return kResultFalse; - if (!s.writeStr8(scalaFile.c_str())) + if (!s.writeStr8(toPlatformAgnosticPath(scalaFile).string().c_str())) return kResultFalse; if (!s.writeInt32(scalaRootKey))