Today's quirk, which I can't believe I didn't realize a long, long, long time ago. unlink on Windows doesn't remove read-only files.
- Personal experience: char *file = "path to readonly file"; int res = unlink(file); assert(res==0);
Obviously we can't modify unlink to behave like Linux. So if unlink fails we need to remove the read-only attribute from the file to properly remove the file. Here is how to remove the read-only attribute from file programmatically in C++ on Windows:
::SetFileAttributes( "path to readonly file", FILE_ATTRIBUTE_NORMAL);