OSXOperatingSystem.st
changeset 22655 bf2c170bc0f1
parent 22491 e3e465028518
child 22833 60d71a4c5600
equal deleted inserted replaced
22654:89f1648e4a05 22655:bf2c170bc0f1
       
     1 "{ Encoding: utf8 }"
       
     2 
     1 "
     3 "
     2  COPYRIGHT (c) 2013 by Claus Gittinger
     4  COPYRIGHT (c) 2013 by Claus Gittinger
     3 	      All Rights Reserved
     5 	      All Rights Reserved
     4 
     6 
     5  This software is furnished under a license and may be used
     7  This software is furnished under a license and may be used
   503 
   505 
   504     "Modified: / 28-02-2017 / 01:05:04 / cg"
   506     "Modified: / 28-02-2017 / 01:05:04 / cg"
   505 ! !
   507 ! !
   506 
   508 
   507 !OSXOperatingSystem class methodsFor:'dummy shell operations'!
   509 !OSXOperatingSystem class methodsFor:'dummy shell operations'!
       
   510 
       
   511 openApplicationForDocument:aFilenameOrString operation:operationSymbol
       
   512     "open a windows-shell/mac finder/desktop application to present the document contained in aFilenameOrString.
       
   513      This is typically used to present help-files, html documents, pdf documents etc.
       
   514      operationSymbol is one of:
       
   515         open
       
   516         edit
       
   517         explore
       
   518     "
       
   519 
       
   520     |openCmd|
       
   521 
       
   522     (openCmd := self openApplicationHelperCommand) notNil ifTrue:[
       
   523         (operationSymbol = 'open') ifTrue:[
       
   524             self executeCommand:'open "',aFilenameOrString asFilename pathName,'"'
       
   525         ] ifFalse:[
       
   526             (operationSymbol = 'explore') ifTrue:[
       
   527                 self executeCommand:'open -R "',aFilenameOrString asFilename pathName,'"'
       
   528             ].
       
   529         ].
       
   530     ].
       
   531 !
   508 
   532 
   509 openApplicationHelperCommand
   533 openApplicationHelperCommand
   510     "Return a command line helper to open a default application for file or URL"
   534     "Return a command line helper to open a default application for file or URL"
   511 
   535 
   512     (self canExecuteCommand: 'open') ifTrue:[
   536     (self canExecuteCommand: 'open') ifTrue:[
   614 	].
   638 	].
   615     ].
   639     ].
   616     ^ path
   640     ^ path
   617 !
   641 !
   618 
   642 
       
   643 getDocumentsDirectory
       
   644     "return your documents directory.
       
   645      Under osx, that's the user's 'Documents' folder.
       
   646      The fallback for other OS's may return the user's home directory."
       
   647 
       
   648     "{ Pragma: +optSpace }"
       
   649 
       
   650     |home documentsFolder|
       
   651 
       
   652     (home := self getHomeDirectory) notNil ifTrue:[
       
   653         (documentsFolder := home asFilename / 'Documents') exists ifTrue:[
       
   654             ^ documentsFolder pathName
       
   655         ].
       
   656     ].
       
   657     ^ home
       
   658 
       
   659     "
       
   660      OperatingSystem getDocumentsDirectory
       
   661     "
       
   662 !
       
   663 
   619 getDriveList
   664 getDriveList
   620     "return a list of volumes in the system."
   665     "return a list of volumes in the system."
   621 
   666 
   622     ^ ('/Volumes' asFilename directoryContents)
   667     ^ ('/Volumes' asFilename directoryContents)
   623       , super getDriveList
   668       , super getDriveList
   829 !
   874 !
   830 
   875 
   831 version_CVS
   876 version_CVS
   832     ^ '$Header$'
   877     ^ '$Header$'
   833 ! !
   878 ! !
       
   879