--- a/AbstractOperatingSystem.st Mon Jul 01 22:14:20 2013 +0100
+++ b/AbstractOperatingSystem.st Tue Jul 09 22:51:30 2013 +0100
@@ -605,12 +605,53 @@
This looks for the files extension, and is typically used to present help-files,
html documents, pdf documents etc.
operationSymbol is one of:
- open
- edit
- explore
- "
-
- "/ use a fileBrowser
+ open
+ edit
+ explore
+ "
+
+ self openApplicationForDocument:aFilenameOrString operation:operationSymbol mimeType:nil
+!
+
+openApplicationForDocument:aFilenameOrString operation:operationSymbol mimeType:mimeTypeStringArg
+ "open a windows-shell application to present the document contained in aFilenameOrString.
+ This looks for the files extension, and is typically used to present help-files,
+ html documents, pdf documents etc.
+ operationSymbol is one of:
+ open
+ edit
+ explore
+ mimeTypeStringArg is e.g. 'text/html' or: 'application/pdf'
+ "
+
+ |openCommand mimeTypeString|
+
+ mimeTypeString := mimeTypeStringArg.
+
+ MIMETypes notNil ifTrue:[
+ mimeTypeString isNil ifTrue:[
+ mimeTypeString := MIMETypes mimeTypeForFilename:aFilenameOrString.
+ ].
+ openCommand := MIMETypes defaultCommandTemplateToOpenMimeType:mimeTypeString.
+ ].
+ openCommand notEmptyOrNil ifTrue:[
+ (openCommand includesSubString:'%1') ifTrue:[
+ openCommand := openCommand bindWith:aFilenameOrString asString.
+ ] ifFalse:[
+ openCommand := openCommand, ' "', aFilenameOrString asString, '"'.
+ ].
+
+ (self
+ startProcess:openCommand
+ inputFrom:nil outputTo:nil
+ errorTo:nil auxFrom:nil
+ environment:nil inDirectory:nil) notNil
+ ifTrue:[
+ ^ self.
+ ].
+ ].
+
+ "/ last resort: use a fileBrowser
UserPreferences current fileBrowserClass openOn:aFilenameOrString
"
@@ -2284,6 +2325,15 @@
"
!
+accessModeOfFd:aFileDescriptor
+ "return a number representing access rights rwxrwxrwx for owner,
+ group and others. Return nil if such a file does not exist.
+ Notice that the returned number is OS dependent - use the
+ modeMasks as returned by OperatingSystem>>accessMaskFor:"
+
+ ^ self subclassResponsibility
+!
+
changeAccessModeOf:aPathName to:modeBits
"change the access rights of aPathName to the OS dependent modeBits.
You should construct this mask using accessMaskFor, to be OS
@@ -2291,6 +2341,16 @@
false if such a file does not exist or change was not allowd."
self subclassResponsibility
+!
+
+changeAccessModeOfFd:aFileDescriptor to:modeBits
+ "change the access rights of the file referenced by aFileDescriptor
+ to the OS dependent modeBits.
+ You should construct this mask using accessMaskFor, to be OS
+ independent. Return true if changed,
+ false if such a file does not exist or change was not allowd."
+
+ ^ self subclassResponsibility
! !
!AbstractOperatingSystem class methodsFor:'file locking'!
@@ -7189,11 +7249,11 @@
!AbstractOperatingSystem class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.237 2013-05-15 13:57:09 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.239 2013-07-08 19:27:09 stefan Exp $'
!
version_CVS
- ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.237 2013-05-15 13:57:09 stefan Exp $'
+ ^ '$Header: /cvs/stx/stx/libbasic/AbstractOperatingSystem.st,v 1.239 2013-07-08 19:27:09 stefan Exp $'
! !