Save paths in an agnostic format
This commit is contained in:
parent
338d946b9a
commit
5e4cee48c4
3 changed files with 8 additions and 7 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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__)
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue