diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-03-26 14:38:07 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2014-03-26 14:38:07 (GMT) |
commit | 0d475f68d96279bbbd554fb4223b2c4fa333adba (patch) | |
tree | 0e6cfb17fc9375d1986157c9b4d1f8887eccf884 /win | |
parent | 72ae8dccf119510f1b175a9a2243a87069cef308 (diff) | |
parent | 07ba2fc47f5d9c888ccb11ca3666f215159b5f45 (diff) | |
download | tcl-0d475f68d96279bbbd554fb4223b2c4fa333adba.zip tcl-0d475f68d96279bbbd554fb4223b2c4fa333adba.tar.gz tcl-0d475f68d96279bbbd554fb4223b2c4fa333adba.tar.bz2 |
Implement RFE [b42b208ba4]: file attributes -readonly (and -archive, -hidden, -system) on Cygwin.
Diffstat (limited to 'win')
-rw-r--r-- | win/tclWinFCmd.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/win/tclWinFCmd.c b/win/tclWinFCmd.c index 2700cb3..f14d9ff 100644 --- a/win/tclWinFCmd.c +++ b/win/tclWinFCmd.c @@ -1825,12 +1825,12 @@ SetWinFileAttributes( Tcl_Obj *fileName, /* The name of the file. */ Tcl_Obj *attributePtr) /* The new value of the attribute. */ { - DWORD fileAttributes; + DWORD fileAttributes, old; int yesNo, result; const TCHAR *nativeName; nativeName = Tcl_FSGetNativePath(fileName); - fileAttributes = GetFileAttributes(nativeName); + fileAttributes = old = GetFileAttributes(nativeName); if (fileAttributes == 0xffffffff) { StatError(interp, fileName); @@ -1848,7 +1848,8 @@ SetWinFileAttributes( fileAttributes &= ~(attributeArray[objIndex]); } - if (!SetFileAttributes(nativeName, fileAttributes)) { + if ((fileAttributes != old) + && !SetFileAttributes(nativeName, fileAttributes)) { StatError(interp, fileName); return TCL_ERROR; } |