From 2b9ffd15424eb95a21db6e6ca35339b3d9372b2e Mon Sep 17 00:00:00 2001 From: whitequark Date: Thu, 10 May 2018 15:31:55 +0000 Subject: [PATCH] Fix handling of relative paths with no directory in solvespace-cli. Before this commit, e.g. `solvespace-cli regenerate foo.slvs` would save a file called just `.slvs`. --- src/platform/climain.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/platform/climain.cpp b/src/platform/climain.cpp index af8d7b07..34d3fe36 100644 --- a/src/platform/climain.cpp +++ b/src/platform/climain.cpp @@ -307,7 +307,11 @@ static bool RunCommand(const std::vector args) { size_t replaceAt = outputFile.raw.find('%'); if(replaceAt != std::string::npos) { Platform::Path outputSubst = inputFile.Parent(); - outputSubst = outputSubst.Join(inputFile.FileStem()); + if(outputSubst.IsEmpty()) { + outputSubst = Platform::Path::From(inputFile.FileStem()); + } else { + outputSubst = outputSubst.Join(inputFile.FileStem()); + } outputFile.raw.replace(replaceAt, 1, outputSubst.raw); } Platform::Path absOutputFile = outputFile.Expand(/*fromCurrentDirectory=*/true);