kludge for win32 in #setRootForFile:
authorClaus Gittinger <cg@exept.de>
Thu, 24 Sep 1998 16:57:14 +0200
changeset 1000 efafa57e0313
parent 999 3dc1bc073981
child 1001 4474ba86a5d8
kludge for win32 in #setRootForFile: WIN32 has trouble with network drives.
FileSelectionBrowser.st
--- a/FileSelectionBrowser.st	Thu Sep 24 12:51:34 1998 +0200
+++ b/FileSelectionBrowser.st	Thu Sep 24 16:57:14 1998 +0200
@@ -333,12 +333,31 @@
 !
 
 setRootForFile:aFilename
+    |f root d parent|
+
+    f := aFilename asFilename.
+    root := Filename rootDirectoryOnVolume:f volume.
+
+    "/ on some systems, the root itself is not readable,
+    "/ but subdirs are (WIN32-network drives and VMS)
+
+    (root exists and:[root isDirectory and:[root isReadable]])
+    ifFalse:[
+        "/ search backward from aFilename for the last readable dir.
+        root := f.
+        parent := root directory.
+        [parent exists and:[parent isDirectory and:[parent isReadable]]]
+        whileTrue:[
+            root := parent.
+            parent := root directory.
+        ].
+    ].
+
     self rootOfDirectory
-        value:(Filename 
-                    rootDirectoryOnVolume:
-                        aFilename asFilename volume) pathName
+        value:root pathName
 
     "Created: / 23.9.1998 / 16:36:28 / cg"
+    "Modified: / 24.9.1998 / 15:31:30 / cg"
 !
 
 valueOfFileName