care for non-existing info in #accessTime, #modTime and #fileSize
authorClaus Gittinger <cg@exept.de>
Mon, 17 Aug 1998 10:24:52 +0200
changeset 3768 4801b87c1cd7
parent 3767 bbf560999d90
child 3769 e165c2b17d28
care for non-existing info in #accessTime, #modTime and #fileSize
Filename.st
--- a/Filename.st	Mon Aug 17 10:18:59 1998 +0200
+++ b/Filename.st	Mon Aug 17 10:24:52 1998 +0200
@@ -1502,15 +1502,18 @@
 accessTime
     "return a timeStamp containing the files last access time."
 
-    ^ self info accessed
+    | i |
+
+    (i := self info) isNil ifTrue:[^ nil].
+    ^ i accessed
 
     "
      Filename currentDirectory accessTime 
     "
 
-    "Created: 9.7.1996 / 10:19:15 / cg"
-    "Modified: 9.7.1996 / 10:19:27 / cg"
-    "Modified: 26.9.1997 / 13:05:51 / stefan"
+    "Created: / 9.7.1996 / 10:19:15 / cg"
+    "Modified: / 26.9.1997 / 13:05:51 / stefan"
+    "Modified: / 17.8.1998 / 10:23:44 / cg"
 !
 
 dates
@@ -1545,13 +1548,12 @@
 fileSize
     "return the size of the file in bytes"
 
-    |info|
-
-    info := self info.
-    info isNil ifTrue:[^ nil].
-    ^ info size
-
-    "Modified: 1.11.1996 / 20:24:43 / cg"
+    |i|
+
+    (i := self info) isNil ifTrue:[^ nil].
+    ^ i size
+
+    "Modified: / 17.8.1998 / 10:23:46 / cg"
 !
 
 fileType
@@ -1686,44 +1688,50 @@
      the info (for which corresponding access methods are understood by
      the returned object) is:
 
-	 type  - a symbol giving the files fileType
-	 mode  - numeric access mode 
-	 uid   - owners user id
-	 gid   - owners group id
-	 size  - files size
-	 id    - files number (i.e. inode number)
-	 accessed      - last access time (as osTime-stamp)
-	 modified      - last modification time (as osTime-stamp)
-	 statusChanged - last staus change (as osTime-stamp)
+         type  - a symbol giving the files fileType
+         mode  - numeric access mode 
+         uid   - owners user id
+         gid   - owners group id
+         size  - files size
+         id    - files number (i.e. inode number)
+         accessed      - last access time (as osTime-stamp)
+         modified      - last modification time (as osTime-stamp)
+         statusChanged - last staus change (as osTime-stamp)
 
      Some of the fields may be returned as nil on systems which do not provide
      all of the information.
      The minimum returned info (i.e. on all OS's) will consist of at least:
-	modified
-	size
-	type
+        modified
+        size
+        type
 
      Dont expect things like uid/gid/mode to be non-nil; write your application
      to either handle nil values,
      or (better) use one of isXXXX query methods. (Be prepared for DOS ...)
      (i.e. instead of:
-	someFilename type == #directory
+        someFilename type == #directory
       use
-	someFilename isDirectory
+        someFilename isDirectory
     "
 
     ^ OperatingSystem infoOf:(self osNameForAccess)
 
     "
      Filename currentDirectory info
-     '/dev/null' asFilename info 
+     '/dev/null' asFilename info
      'Make.proto' asFilename info
-     'source/Point.st' asFilename info 
-     'source/Point.st' asFilename linkInfo 
-     '../../libbasic/Point.st' asFilename info 
+     'source/Point.st' asFilename info
+     'source/Point.st' asFilename linkInfo
+     '../../libbasic/Point.st' asFilename info
+     '.' asFilename info
+     '..' asFilename info
+     '..\..' asFilename info
+     '..\..\..' asFilename info
+     '..\..\..\..' asFilename info
+     'c:\' asFilename info
     "
 
-    "Modified: 1.11.1996 / 20:22:40 / cg"
+    "Modified: / 17.8.1998 / 10:24:10 / cg"
 !
 
 linkInfo
@@ -2953,6 +2961,6 @@
 !Filename class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.130 1998-08-14 16:19:03 cg Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/Filename.st,v 1.131 1998-08-17 08:24:52 cg Exp $'
 ! !
 Filename initialize!