isMountPoint
authorpenk
Wed, 25 Sep 2002 11:51:22 +0200
changeset 6772 6bfdc2522ea2
parent 6771 997fec197366
child 6773 26415b61ad09
isMountPoint
AbstractOperatingSystem.st
UnixOperatingSystem.st
--- a/AbstractOperatingSystem.st	Wed Sep 25 11:13:04 2002 +0200
+++ b/AbstractOperatingSystem.st	Wed Sep 25 11:51:22 2002 +0200
@@ -2273,6 +2273,10 @@
     self subclassResponsibility
 !
 
+isMountPoint:aPathName
+    ^ false
+!
+
 isReadable:aPathName
     "return true, if the file/dir 'aPathName' is readable.
      For symbolic links, the pointed-to-file is checked."
@@ -4418,6 +4422,7 @@
 !AbstractOperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.74 2002-08-15 15:45:14 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.75 2002-09-25 09:51:22 penk Exp $'
 ! !
+
 AbstractOperatingSystem initialize!
--- a/UnixOperatingSystem.st	Wed Sep 25 11:13:04 2002 +0200
+++ b/UnixOperatingSystem.st	Wed Sep 25 11:51:22 2002 +0200
@@ -5130,6 +5130,33 @@
     ^ self primitiveFailed
 !
 
+isMountPoint:aPathName
+    "return true, if the given file is a mounted fileSystems mountPoint"
+
+    |procFS|
+
+    procFS := '/proc/mounts' asFilename.
+    procFS exists not ifTrue:[
+        "/ TODO: add fallback code for other OS's
+        ^ false "/ dont know 
+    ].
+
+    procFS readingLinesDo:[:eachLine |
+        |items mountPath|
+
+        items := eachLine asCollectionOfWords.
+        mountPath := items second.
+        mountPath = aPathName ifTrue:[ ^ true ].
+    ].
+    ^ false
+
+    "
+     OperatingSystem isMountPoint:'/phys/qnx'  
+     OperatingSystem isMountPoint:'/proc'      
+     OperatingSystem isMountPoint:'/'      
+    "
+!
+
 isReadable:aPathName
     "return true, if the file/dir 'aPathName' is readable.
      For symbolic links, the pointed-to-file is checked."
@@ -10461,7 +10488,7 @@
 !UnixOperatingSystem::FilePointerHandle class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.125 2002-09-18 14:32:47 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.126 2002-09-25 09:51:14 penk Exp $'
 ! !
 
 !UnixOperatingSystem::FilePointerHandle methodsFor:'release'!
@@ -12081,6 +12108,8 @@
 !UnixOperatingSystem class methodsFor:'documentation'!
 
 version
-    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.125 2002-09-18 14:32:47 penk Exp $'
+    ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.126 2002-09-25 09:51:14 penk Exp $'
 ! !
+
 UnixOperatingSystem initialize!
+UnixOperatingSystem::FileDescriptorHandle initialize!