Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

exFAT workaround #5492

Merged
merged 1 commit into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Fixes
- PythonEditor :
- Fixed output for `print()` calls with multiple arguments, which was previously spread across multiple lines.
- Fixed bug that prevented editors being destroyed at the right time.
- FileSystemPath : Fixed bug on Windows where paths on an exFAT partition were not considered valid.

1.3.4.0 (relative to 1.3.3.0)
=======
Expand Down
22 changes: 21 additions & 1 deletion src/Gaffer/FileSystemPath.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,27 @@ bool FileSystemPath::isValid( const IECore::Canceller *canceller ) const

std::error_code e;

const std::filesystem::file_type t = std::filesystem::symlink_status( std::filesystem::path( this->string() ), e ).type();
std::filesystem::file_type t = std::filesystem::symlink_status( std::filesystem::path( this->string() ), e ).type();

#if defined(_MSC_VER) && _MSC_VER < 1932

// Fix MSVC bug preventing `symlink_status()` working with exFAT partitions, and possibly FAT.
// Filtering to error 87 is based on experimentation and backed up by
// https://github.com/microsoft/STL/issues/233. Using `status()` instead of `symlink_status()`
// allows exFAT partitions to be used, and because exFAT does not support symlinks, this
// should be a valid workaround provided filtering to error value `87` doesn't include
// partitions that do support symlinks.
if(
(
t == std::filesystem::file_type::none || t == std::filesystem::file_type::not_found
) && e.value() == 87 // "The parameter is incorrect."
)
{
t = std::filesystem::status( std::filesystem::path( this->string() ), e ).type();
}

#endif

return t != std::filesystem::file_type::none && t != std::filesystem::file_type::not_found;
}

Expand Down
Loading