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`.pull/332/head
parent
c6fc0125a2
commit
2b9ffd1542
|
@ -307,7 +307,11 @@ static bool RunCommand(const std::vector<std::string> args) {
|
||||||
size_t replaceAt = outputFile.raw.find('%');
|
size_t replaceAt = outputFile.raw.find('%');
|
||||||
if(replaceAt != std::string::npos) {
|
if(replaceAt != std::string::npos) {
|
||||||
Platform::Path outputSubst = inputFile.Parent();
|
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);
|
outputFile.raw.replace(replaceAt, 1, outputSubst.raw);
|
||||||
}
|
}
|
||||||
Platform::Path absOutputFile = outputFile.Expand(/*fromCurrentDirectory=*/true);
|
Platform::Path absOutputFile = outputFile.Expand(/*fromCurrentDirectory=*/true);
|
||||||
|
|
Loading…
Reference in New Issue