Win32: Fix "File|Open...", "Save" and "Save As" when a command line argument is used.

`GetSaveFileNameA` `OPENFILENAMEA` does not like UNC ( "\\\\?\\C:\\..." ) file prefixes in `lpstrFile`.
Work around it by not `Expand`-ing parameters passed on the command line too early.

The only user visible change is that "File|Open Recent" will show items as they
were passed instead of expanded to full path for example:
"..\..\NURBSTests\Intersection2.slvs"

Fixes: https://github.com/solvespace/solvespace/issues/622
pull/517/head^2
ruevs 2020-10-16 16:54:21 +03:00 committed by phkahler
parent d72eba8039
commit 3ea8ebfaf5
2 changed files with 2 additions and 2 deletions

View File

@ -21,7 +21,7 @@ int main(int argc, char** argv) {
dbp("Only the first file passed on command line will be opened."); dbp("Only the first file passed on command line will be opened.");
} }
SS.Load(Platform::Path::From(args.back()).Expand(/*fromCurrentDirectory=*/true)); SS.Load(Platform::Path::From(args.back()));
} }
Platform::RunGui(); Platform::RunGui();

View File

@ -401,7 +401,7 @@ FILE *OpenFile(const Platform::Path &filename, const char *mode) {
ssassert(filename.raw.length() == strlen(filename.raw.c_str()), ssassert(filename.raw.length() == strlen(filename.raw.c_str()),
"Unexpected null byte in middle of a path"); "Unexpected null byte in middle of a path");
#if defined(WIN32) #if defined(WIN32)
return _wfopen(Widen(filename.Expand().raw).c_str(), Widen(mode).c_str()); return _wfopen(Widen(filename.Expand(/*fromCurrentDirectory=*/true).raw).c_str(), Widen(mode).c_str());
#else #else
return fopen(filename.raw.c_str(), mode); return fopen(filename.raw.c_str(), mode);
#endif #endif