--- a/UserPreferences.st Mon Jul 16 12:53:41 2018 +0200
+++ b/UserPreferences.st Mon Jul 16 12:54:33 2018 +0200
@@ -133,67 +133,63 @@
"read the settings from standard places,
If a --preferences command line argument was given, read it from there"
- ( AbortOperationRequest , TerminateProcessRequest , Parser parseErrorSignal ) handle:[:ex |
- 'UserPreferences [error]: error reading settings: ' errorPrint.
- ex description errorPrintCR.
- ex return.
- ] do:[
- "JV@2012-03-07: Try following settings files:
- $HOME/.smalltalk/settings.stx
- $HOME/.smalltalk/settings.rc
- $PWD/settings.stx
- $PWD/settings.rc
-
- in that order. Whichever is found, it is read and the rest
- is not used. Also, path to the file which has beed read is
- stored in 'UserPreferences current at:#settingsFilename'
- "
- |commandLineArguments files continue idx|
-
- files := nil.
- commandLineArguments := Smalltalk commandLineArguments.
-
- idx := commandLineArguments indexOf: '--preferences'.
- idx ~~ 0 ifTrue:[
- | file |
-
- commandLineArguments size <= idx ifTrue:[
- self error:'UserPreferences [error]: --preferences requires an argument, none given'
- ].
- file := (Smalltalk commandLineArguments at: idx + 1) asFilename.
- file exists ifFalse:[
- self error:('UserPreferences [error]: preference file ''', file pathName,''' does not exist').
- ].
- file isDirectory ifTrue:[
- self error:('UserPreferences [error]: preference file ''', file pathName,''' is not a regular file').
- ].
- file isReadable ifFalse:[
- self error:('UserPreferences [error]: preference file ''', file pathName,''' is not readable (check permissions)').
- ].
- files := Array with: file.
- commandLineArguments removeAtIndex: idx + 1.
- commandLineArguments removeAtIndex: idx.
+ "JV@2012-03-07: Try following settings files:
+ $HOME/.smalltalk/settings.stx
+ $HOME/.smalltalk/settings.rc
+ $PWD/settings.stx
+ $PWD/settings.rc
+
+ in that order. Whichever is found, it is read and the rest
+ is not used. Also, path to the file which has beed read is
+ stored in 'UserPreferences current at:#settingsFilename'
+ "
+ |commandLineArguments files continue idx|
+
+ files := nil.
+ commandLineArguments := Smalltalk commandLineArguments.
+
+ idx := commandLineArguments indexOf: '--preferences'.
+ idx ~~ 0 ifTrue:[
+ | file |
+
+ commandLineArguments size <= idx ifTrue:[
+ self error:'UserPreferences [error]: --preferences requires an argument, none given'
+ ].
+ file := (Smalltalk commandLineArguments at: idx + 1) asFilename.
+ file exists ifFalse:[
+ self error:('UserPreferences [error]: preference file ''', file pathName,''' does not exist').
+ ].
+ file isDirectory ifTrue:[
+ self error:('UserPreferences [error]: preference file ''', file pathName,''' is not a regular file').
].
- files isNil ifTrue:[
- files := {
- (Filename homeDirectory / '.smalltalk' / 'settings.stx') . "/ per-user settings file (new default?)
- (Filename homeDirectory / '.smalltalk' / 'settings.rc') . "/ for backward compatibility with jv-branch
- (Smalltalk getSystemFileName: 'settings.stx') . "/ old stx default
- (Smalltalk getSystemFileName: 'settings.rc') . "/ for backward compatibility with jv-branch
- }.
+ file isReadable ifFalse:[
+ self error:('UserPreferences [error]: preference file ''', file pathName,''' is not readable (check permissions)').
].
- continue := true.
- files do:[:each|
- | eachFile |
-
- (continue and:[each notNil and:[(eachFile := each asFilename) exists]]) ifTrue:[
- continue := false.
- eachFile pathName infoPrintCR.
- eachFile fileIn.
- UserPreferences current at:#settingsFilename put: eachFile pathName.
- ].
+ files := Array with: file.
+ commandLineArguments removeAtIndex: idx + 1.
+ commandLineArguments removeAtIndex: idx.
+ ].
+ files isNil ifTrue:[
+ files := {
+ (Filename homeDirectory / '.smalltalk' / 'settings.stx') . "/ per-user settings file (new default?)
+ (Filename homeDirectory / '.smalltalk' / 'settings.rc') . "/ for backward compatibility with jv-branch
+ (Smalltalk getSystemFileName: 'settings.stx') . "/ old stx default
+ (Smalltalk getSystemFileName: 'settings.rc') . "/ for backward compatibility with jv-branch
+ }.
+ ].
+ continue := true.
+ files do:[:each|
+ | eachFile |
+
+ (continue and:[each notNil and:[(eachFile := each asFilename) exists]]) ifTrue:[
+ continue := false.
+ eachFile pathName infoPrintCR.
+ eachFile fileIn.
+ UserPreferences current at:#settingsFilename put: eachFile pathName.
].
- continue ifTrue:[
+ ].
+ continue ifTrue:[
+ Smalltalk silentLoading ifFalse:[
'UserPreferences [info]: no settings.stx file found' infoPrintCR
].
].