gulrak / filesystem

An implementation of C++17 std::filesystem for C++11 /C++14/C++17/C++20 on Windows, macOS, Linux and FreeBSD.
MIT License
1.31k stars 168 forks source link

Fix `ghc::filesystem::last_write_time()` setter on iOS/tvOS/watchOS #153

Closed kkaefer closed 1 year ago

kkaefer commented 1 year ago

The previous implementation tried to detect old deployment targets for macOS that doesn't have the newer utimensat call. Unfortunately, it would just detect macOS, and didn't check for the corresponding iOS/tvOS/watchOS version numbers. On those platforms, last_write_time() was effectively a no-op, failing silently and not modifying the mtime of the file.

This patch adds detection for these platforms. It also removes the special casing when newer versions of macOS/iOS/tvOS/watchOS are used as the deployment targets, and instead folds it into the default POSIX branch.

gulrak commented 1 year ago

Thanks for the PR, but I would need to look into this more. I don't see those as macOS variants and they shouldn't be detected as such... I'll try to look into it next weekend if possible.

gulrak commented 1 year ago

Thank you for the nice solution, it is for sure better than the current state.