You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On 04/09/2018 10:27 PM, Ecstatic Coder wrote:
> On Tuesday, 4 September 2018 at 09:56:13 UTC, rikki cattermole wrote:>> On 04/09/2018 9:40 PM, Ecstatic Coder wrote:>>> But it seems that the latest version of "std.file.copy" now completely ignores the "PreserveAttributes.no" argument on Windows, which made recent Windows builds of Resync fail on read-only files.>>>> What???>>>> There is nothing in the changelog between 2.080.0 and 2.082.0 for changes to std.file.>>>> Version from July 2017[0]. Version from 2.082.0[1]. They look the same to me.>>>> [0]https://github.com/dlang/phobos/blob/d8959320e0c47a1861e32bbbf6a3ba30a019798e/std/file.d#L3430>> [1]https://github.com/dlang/phobos/blob/v2.082.0/std/file.d#L4216>> Mayb I'm wrong, but what I can say is that I've recently updated DMD and compiled a windows build of Resync, and that I *HAD* to make Windows-specific code that removes the "read-only" attributes only on Windows.>> attributes = source_file_path.getAttributes();> source_file_path.getTimes( access_time, modification_time );>> version ( Windows )> {> if ( target_file_path.exists() )> {> target_file_path.setAttributes( attributes & ~1 );> }>> source_file_path.copy( target_file_path, PreserveAttributes.no );> target_file_path.setAttributes( attributes & ~1 );> target_file_path.setTimes( access_time, modification_time );> target_file_path.setAttributes( attributes );> }> else> {> if ( target_file_path.exists() )> {> target_file_path.setAttributes( 511 );> }>> source_file_path.copy( target_file_path, PreserveAttributes.no );> target_file_path.setAttributes( attributes );> target_file_path.setTimes( access_time, modification_time );> }>> Honestly I don't see why I have to make this ugly fix on Windows, while the Linux version has always worked fine on read-only files.
Hang on a second.
assert(preserve == Yes.preserveAttributes);
Something is smelling an awful lot here.
Up to Windows 7 CopyFileW which is used for Windows didn't copy the attributes over[0] but it does now.
This is a bug on our end, which should include a fallback to copying manually the file contents over.
[0]https://docs.microsoft.com/en-us/windows/desktop/api/winbase/nf-winbase-copyfilew
The text was updated successfully, but these errors were encountered:
bugzilla (@WalterBright) reported this on 2018-09-04T21:45:14Z
Transfered from https://issues.dlang.org/show_bug.cgi?id=19221
Description
The text was updated successfully, but these errors were encountered: