--- a/OSXOperatingSystem.st Mon Mar 26 16:10:47 2018 +0200
+++ b/OSXOperatingSystem.st Mon Mar 26 16:10:57 2018 +0200
@@ -1,3 +1,5 @@
+"{ Encoding: utf8 }"
+
"
COPYRIGHT (c) 2013 by Claus Gittinger
All Rights Reserved
@@ -506,6 +508,28 @@
!OSXOperatingSystem class methodsFor:'dummy shell operations'!
+openApplicationForDocument:aFilenameOrString operation:operationSymbol
+ "open a windows-shell/mac finder/desktop application to present the document contained in aFilenameOrString.
+ This is typically used to present help-files, html documents, pdf documents etc.
+ operationSymbol is one of:
+ open
+ edit
+ explore
+ "
+
+ |openCmd|
+
+ (openCmd := self openApplicationHelperCommand) notNil ifTrue:[
+ (operationSymbol = 'open') ifTrue:[
+ self executeCommand:'open "',aFilenameOrString asFilename pathName,'"'
+ ] ifFalse:[
+ (operationSymbol = 'explore') ifTrue:[
+ self executeCommand:'open -R "',aFilenameOrString asFilename pathName,'"'
+ ].
+ ].
+ ].
+!
+
openApplicationHelperCommand
"Return a command line helper to open a default application for file or URL"
@@ -616,6 +640,27 @@
^ path
!
+getDocumentsDirectory
+ "return your documents directory.
+ Under osx, that's the user's 'Documents' folder.
+ The fallback for other OS's may return the user's home directory."
+
+ "{ Pragma: +optSpace }"
+
+ |home documentsFolder|
+
+ (home := self getHomeDirectory) notNil ifTrue:[
+ (documentsFolder := home asFilename / 'Documents') exists ifTrue:[
+ ^ documentsFolder pathName
+ ].
+ ].
+ ^ home
+
+ "
+ OperatingSystem getDocumentsDirectory
+ "
+!
+
getDriveList
"return a list of volumes in the system."
@@ -831,3 +876,4 @@
version_CVS
^ '$Header$'
! !
+