diff -r a4d708790f90 -r 73c3f28d8960 Win32OperatingSystem.st --- a/Win32OperatingSystem.st Sat Jun 20 11:16:54 2009 +0200 +++ b/Win32OperatingSystem.st Mon Jun 22 16:52:12 2009 +0200 @@ -5279,69 +5279,72 @@ isWritable:aPathName "return true, if the given file is writable. - For symbolic links, the pointed-to-file is checked." + For symbolic links, the pointed-to-file is checked. + + In Windows, files can possibly be created in and deleted from directories marked as + read only. See http://support.microsoft.com/kb/326549. So we always return true + for directories." %{ int ret; if (__isString(aPathName)) { #ifdef DO_WRAP_CALLS - char _aPathName[MAXPATHLEN]; - - strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0'; - do { - __threadErrno = 0; - ret = STX_API_CALL1( "GetFileAttributes", GetFileAttributes, _aPathName); - } while ((ret < 0) && (__threadErrno == EINTR)); -#else - ret = GetFileAttributes((char *) __stringVal(aPathName)); - if (ret < 0) { - __threadErrno = __WIN32_ERR(GetLastError()); - } -#endif - if (ret < 0) { - @global(LastErrorNumber) = __mkSmallInteger(__threadErrno); - RETURN ( false ); - } - RETURN ( (ret & FILE_ATTRIBUTE_READONLY) ? false : true); - } - if (__isUnicode16String(aPathName)) { - int ret; - - /* - * under windows, all files are readable ... - * so, only check for the files existence here. - */ - wchar_t _wPathName[MAXPATHLEN+1]; - int i, l; - - l = __unicode16StringSize(aPathName); - if (l > MAXPATHLEN) l = MAXPATHLEN; - for (i=0; i MAXPATHLEN) l = MAXPATHLEN; + for (i=0; i MAX_PATH) l = MAX_PATH; - - for (i=0; i MAX_PATH) l = MAX_PATH; + + for (i=0; i MAX_PATH) l = MAX_PATH; - - for (i=0; i MAX_PATH) l = MAX_PATH; + + for (i=0; i