Skip to content

Fix #2648 - Studio: shapes imported after "Save As" fail with "Error reading" - #2651

Merged
akenmorris merged 3 commits into
masterfrom
amorris/2648-studio-save-as
Sep 14, 2026
Merged

akenmorris merged 3 commits into
masterfrom
amorris/2648-studio-save-as

Conversation

@akenmorris

Copy link
Copy Markdown
Contributor

Make file existence checks agree with the mesh and image readers

boost::filesystem::is_regular_file() opens a file handle on Windows and reports false whenever that fails, so files that VTK and ITK read without trouble were rejected before the reader ever saw them. Use vtksys for the existence checks, which queries attributes and only opens a handle for reparse points, and imbue boost's path with a UTF-8 codecvt at startup so the remaining boost calls stop mangling non-ASCII paths.

Also makes Project::set_project_path tolerant when a path can't be re-anchored to a new project location, so one awkward path no longer silently skips the rewrite or fails the entire save.

boost::filesystem::is_regular_file() opens a file handle on Windows and reports
false whenever that fails, so files that VTK and ITK read without trouble were
rejected before the reader ever saw them. Use vtksys for the existence checks,
which queries attributes and only opens a handle for reparse points, and imbue
boost's path with a UTF-8 codecvt at startup so the remaining boost calls stop
mangling non-ASCII paths.

Also makes Project::set_project_path tolerant when a path can't be re-anchored
to a new project location, so one awkward path no longer silently skips the
rewrite or fails the entire save.
Including boost/nowide/utf8_codecvt.hpp emits the auto-link pragma for
boost_nowide.lib, which the Windows dependency build does not produce, failing
the link. The codecvt facet is entirely header-only, so define
BOOST_NOWIDE_NO_LIB ahead of every Boost header to opt out of auto-linking.
VTK's legacy .vtk reader stats the file before opening it, and on Windows that
stat deliberately omits the \\?\ prefix, so a path beyond MAX_PATH can be
written but never read back. The STL reader and writer go through
SystemTools::Fopen, which applies the prefix, so they exercise what the test is
actually about: that the existence check no longer rejects such a path.
@akenmorris
akenmorris merged commit 60fd926 into master Sep 14, 2026
5 checks passed
@akenmorris
akenmorris deleted the amorris/2648-studio-save-as branch September 14, 2026 22:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant