added #setHidden: and #setNormal:
authorsr
Wed, 27 Jun 2007 14:05:00 +0200
changeset 10622 87a51cae9161
parent 10621 5e6966b208f5
child 10623 5bc26319a05a
added #setHidden: and #setNormal:
Win32OperatingSystem.st
--- a/Win32OperatingSystem.st	Fri Jun 22 16:02:50 2007 +0200
+++ b/Win32OperatingSystem.st	Wed Jun 27 14:05:00 2007 +0200
@@ -5079,6 +5079,54 @@
 "
 !
 
+setHidden:aPathName
+    "return true, if the hidden attribute could be setted to true"
+
+%{
+    int ret;
+
+    if (__isString(aPathName)) {
+        char _aPathName[MAXPATHLEN];
+
+        strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+        ret = STX_API_CALL2( "SetFileAttributes", SetFileAttributes, _aPathName, FILE_ATTRIBUTE_HIDDEN );
+
+        if (ret != 0) {
+            __threadErrno = __WIN32_ERR(GetLastError());
+        }
+
+        RETURN (true);
+    }
+%}.
+    ^ self primitiveFailed
+!
+
+setNormal:aPathName
+    "
+    sets all file attributes to the normal state
+
+    e.g. set the hidden attribute to false (unhidden)
+    "
+
+%{
+    int ret;
+
+    if (__isString(aPathName)) {
+        char _aPathName[MAXPATHLEN];
+
+        strncpy(_aPathName, __stringVal(aPathName), MAXPATHLEN-1); _aPathName[MAXPATHLEN-1] = '\0';
+        ret = STX_API_CALL2( "SetFileAttributes", SetFileAttributes, _aPathName, FILE_ATTRIBUTE_NORMAL );
+
+        if (ret != 0) {
+            __threadErrno = __WIN32_ERR(GetLastError());
+        }
+
+        RETURN (true);
+    }
+%}.
+    ^ self primitiveFailed
+!
+
 timeOfLastAccess:aPathName
     "return the time, when the file was last accessed.
      For nonexistent files, nil is returned."
@@ -12925,7 +12973,7 @@
 !Win32OperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.281 2007-06-15 10:05:23 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Win32OperatingSystem.st,v 1.282 2007-06-27 12:05:00 sr Exp $'
 ! !
 
 Win32OperatingSystem initialize!