aboutsummaryrefslogtreecommitdiff
path: root/src/zencore/filesystem.cpp
diff options
context:
space:
mode:
authorDan Engelbrecht <[email protected]>2025-03-12 18:58:24 +0100
committerGitHub Enterprise <[email protected]>2025-03-12 18:58:24 +0100
commit908f99b749fbbf9754f9485d680914792034334c (patch)
tree2d4e70fa49d3c95c509f230cb2dc5269358a3b59 /src/zencore/filesystem.cpp
parentRemove spurious '4' in conditional code block (diff)
downloadzen-908f99b749fbbf9754f9485d680914792034334c.tar.xz
zen-908f99b749fbbf9754f9485d680914792034334c.zip
fix quoted command lines arguments (#306)
Handling of quotes and quotes with leading backslash for command line parsing - UE-231677
Diffstat (limited to 'src/zencore/filesystem.cpp')
-rw-r--r--src/zencore/filesystem.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/zencore/filesystem.cpp b/src/zencore/filesystem.cpp
index 9f3f4f7fc..05e2bf049 100644
--- a/src/zencore/filesystem.cpp
+++ b/src/zencore/filesystem.cpp
@@ -2043,6 +2043,19 @@ SetFileReadOnly(const std::filesystem::path& Filename, bool ReadOnly)
return false;
}
+std::filesystem::path
+StringToPath(const std::string_view& Path)
+{
+ if (Path.length() > 2 && Path.front() == '\"' && Path.back() == '\"')
+ {
+ return std::filesystem::path(Path.substr(1, Path.length() - 2)).make_preferred();
+ }
+ else
+ {
+ return std::filesystem::path(Path).make_preferred();
+ }
+}
+
//////////////////////////////////////////////////////////////////////////
//
// Testing related code follows...