OSXOperatingSystem.st
author Stefan Vogel <sv@exept.de>
Mon, 22 Jun 2015 11:33:37 +0200
branchexpecco_2_7_5_branch
changeset 18499 b132ac7c9d6a
parent 16905 46653de3c189
child 17177 28ebbb908d3e
permissions -rw-r--r--
GLIBC 2.12 compatibility

"{ Package: 'stx:libbasic' }"

UnixOperatingSystem subclass:#OSXOperatingSystem
	instanceVariableNames:''
	classVariableNames:''
	poolDictionaries:''
	category:'OS-Unix'
!


!OSXOperatingSystem class methodsFor:'file queries'!

caseSensitiveFilenames
    "return true, if the OS has caseSensitive file naming.
     On MSDOS, this will return false;
     on a real OS, we return true."

    ^ false

    "Modified: / 5.6.1998 / 18:35:18 / cg"
!

defaultPackagePath
    "redefined to add stx.app packages and /Library stuff"

    |path executablePath executableDir packagesDir libDir vsnDirName vsnDir|

    path := super defaultPackagePath.

    executablePath := OperatingSystem pathOfSTXExecutable.
    executablePath notNil ifTrue:[
        executableDir := executablePath asFilename directory.
        packagesDir := executableDir directory directory / 'Packages'.
        packagesDir exists ifTrue:[
            path add:packagesDir.
        ].
        libDir := '/Library/Smalltalk-x' asFilename.
        libDir exists ifTrue:[
            vsnDirName := '%1.%2' bindWith:Smalltalk majorVersionNr
                                  with:Smalltalk minorVersionNr.
            vsnDir := libDir / vsnDirName.
            vsnDir exists ifTrue:[
                path add:vsnDir.
            ].
        ].
    ].
    ^ path
!

getDriveList
    "return a list of volumes in the system."

    ^ ('/Volumes' asFilename directoryContents)
      , super getDriveList
!

getTrashDirectory
    "get the name of a trash folder (if the OS supports it),
     or nil, if not.
     Must be redefined to return non nil in concrete operating systems"

    ^ '~/.Trash'
!

pathNameForDrive:driveName
    "given a drive name, return the pathname to open it as a directory.
     For Windows, this is the driveName itself.
     For OSX, '/Volumes' is prepended.
     Other OSs might prepent the pount point (i.e. /mnt/)"

    driveName isNil ifTrue:[^ nil].
    driveName asFilename isAbsolute ifTrue:[^ driveName].
    ^ '/Volumes/',driveName
! !

!OSXOperatingSystem class methodsFor:'documentation'!

version
    ^ '$Header: /cvs/stx/stx/libbasic/OSXOperatingSystem.st,v 1.8 2014-10-23 10:59:46 cg Exp $'
!

version_CVS
    ^ '$Header: /cvs/stx/stx/libbasic/OSXOperatingSystem.st,v 1.8 2014-10-23 10:59:46 cg Exp $'
! !