aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/filesystem.cpp
diff options
context:
space:
mode:
authorZousar Shaker <[email protected]>2025-03-27 08:44:43 -0600
committerGitHub Enterprise <[email protected]>2025-03-27 08:44:43 -0600
commit697ba032e65248352305920fb90024e7ba6885f3 (patch)
tree055e4369f3691d32068407ca72c07d4f67d2303a /src/zencore/filesystem.cpp
parentMerge branch 'main' into zs/ui-show-cook-artifacts (diff)
parentoptional compress of block chunks (#326) (diff)
downloadzen-697ba032e65248352305920fb90024e7ba6885f3.tar.xz
zen-697ba032e65248352305920fb90024e7ba6885f3.zip
Merge branch 'main' into zs/ui-show-cook-artifacts
Diffstat (limited to 'src/zencore/filesystem.cpp')
-rw-r--r--src/zencore/filesystem.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/zencore/filesystem.cpp b/src/zencore/filesystem.cpp
index 05e2bf049..8a369f02e 100644
--- a/src/zencore/filesystem.cpp
+++ b/src/zencore/filesystem.cpp
@@ -2046,14 +2046,17 @@ SetFileReadOnly(const std::filesystem::path& Filename, bool ReadOnly)
std::filesystem::path
StringToPath(const std::string_view& Path)
{
+ std::string_view UnquotedPath = Path;
+
if (Path.length() > 2 && Path.front() == '\"' && Path.back() == '\"')
{
- return std::filesystem::path(Path.substr(1, Path.length() - 2)).make_preferred();
+ UnquotedPath = Path.substr(1, Path.length() - 2);
}
- else
+ if (UnquotedPath.ends_with('/') || UnquotedPath.ends_with('\\') || UnquotedPath.ends_with(std::filesystem::path::preferred_separator))
{
- return std::filesystem::path(Path).make_preferred();
+ UnquotedPath = UnquotedPath.substr(0, UnquotedPath.length() - 1);
}
+ return std::filesystem::path(UnquotedPath).make_preferred();
}
//////////////////////////////////////////////////////////////////////////