ITK icon indicating copy to clipboard operation
ITK copied to clipboard

WIP: Use std filesystem path

Open blowekamp opened this issue 10 months ago • 3 comments

Add std::filesystem::path to ImageIOBase for eventual wchar support for paths.

This proposes an approach to remove direct access to m_FileName, with the eventual end goal to use GetFilePath and "legacy" GetFileName methods.

Add Set/Get FilePath member functions to ImageIOBase, with the future
plan to replace the m_FileName member variable with these access
member functions. The m_FileName is directly access by derived ImageIO
classes.

The m_FileName is now "constant" to disallow derived classes from
directly writing to the variable.  The SetFilePath method updates the
legacy const m_FileName to maintain compatibility.

blowekamp avatar Apr 05 '24 13:04 blowekamp

@blowekamp Very interesting, thanks! I definitely like having a separate type for file paths, rather than just "std::string", for improved type safety. I'm also curious to see if it does improve non-ASCII character support in file names, on Windows.

N-Dekker avatar Apr 05 '24 14:04 N-Dekker

It looks like adopting std::filesystem would require increasing ITK's minimum macOS to 10.15:

https://stackoverflow.com/questions/58667853/does-use-of-c17-stdfilesystem-require-macos-10-15-xcode-11-1

Even though C++17 compilers exist on older version of macOS, the STL shipped on older versions does not support std::filesystem, from what I gather.

That would suck for me, I still support back to 10.13.

seanm avatar May 06 '24 01:05 seanm

I still support back to 10.13.

Our Python packages also require 10.11.

thewtex avatar May 06 '24 17:05 thewtex