UnixOperatingSystem.st
changeset 4853 3f5ed291c362
parent 4753 214fc4e89e7a
child 4882 fb4dafb482fb
equal deleted inserted replaced
4852:ac51b47d8768 4853:3f5ed291c362
  3967 	with:(Filename currentDirectory pathName)
  3967 	with:(Filename currentDirectory pathName)
  3968 
  3968 
  3969     "Modified: / 5.6.1998 / 18:35:35 / cg"
  3969     "Modified: / 5.6.1998 / 18:35:35 / cg"
  3970 !
  3970 !
  3971 
  3971 
       
  3972 getMountedVolumes
       
  3973     "return info about mounted volumes. 
       
  3974      The amount of information returned depends upon the OS, and is
       
  3975      not guaranteed to be consistent across architectures.
       
  3976      On unix, the information returned is (at least):
       
  3977         mountPoint - mount point
       
  3978         fileSystem - device or NFS-remotePath
       
  3979     "
       
  3980 
       
  3981     |p outputText keys values info infoEntry|
       
  3982 
       
  3983     p := PipeStream readingFrom:('df').
       
  3984     p isNil ifTrue:[^ nil].
       
  3985 
       
  3986     [
       
  3987         outputText := p contentsOfEntireFile.
       
  3988     ] valueNowOrOnUnwindDo:[
       
  3989         p close.
       
  3990     ].
       
  3991 "/ Transcript showCR:outputText asString.
       
  3992     outputText isNil ifTrue:[^ nil].
       
  3993 
       
  3994     outputText := outputText asCollectionOfLines.
       
  3995     outputText size < 2 ifTrue:[^ nil].
       
  3996 
       
  3997     keys := (outputText at:1) asLowercase asCollectionOfWords.
       
  3998     "/ we may have to validate the following column indices
       
  3999     "/ on some rude Unix versions ...
       
  4000 
       
  4001     info := OrderedCollection new.
       
  4002 
       
  4003     outputText from:2 do:[:line |
       
  4004         values := line asCollectionOfWords.
       
  4005 
       
  4006         values size >= 2 ifTrue:[
       
  4007 
       
  4008             infoEntry := IdentityDictionary new.
       
  4009             infoEntry at:#mountPoint put:(values last).
       
  4010             infoEntry at:#fileSystem put:(values first).
       
  4011             info add:infoEntry.
       
  4012         ]
       
  4013     ].
       
  4014     ^ info
       
  4015 
       
  4016     "
       
  4017      OperatingSystem getMountedVolumes
       
  4018     "
       
  4019 
       
  4020     "Modified: / 22.5.1999 / 00:32:13 / cg"
       
  4021 !
       
  4022 
  3972 getNullDevice
  4023 getNullDevice
  3973     "return the name of the OS's null device"
  4024     "return the name of the OS's null device"
  3974 
  4025 
  3975     ^ '/dev/null'
  4026     ^ '/dev/null'
  3976 !
  4027 !
  8651 ! !
  8702 ! !
  8652 
  8703 
  8653 !UnixOperatingSystem class methodsFor:'documentation'!
  8704 !UnixOperatingSystem class methodsFor:'documentation'!
  8654 
  8705 
  8655 version
  8706 version
  8656     ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.69 1999-09-17 14:07:58 cg Exp $'
  8707     ^ '$Header: /cvs/stx/stx/libbasic/UnixOperatingSystem.st,v 1.70 1999-10-06 12:59:44 ca Exp $'
  8657 ! !
  8708 ! !
  8658 UnixOperatingSystem initialize!
  8709 UnixOperatingSystem initialize!