Issue #98: Added -P / --package-path command line option
...to modify package path from command line. Just like java's -cp / --classpath
--- a/SmalltalkStartup.st Mon Jun 27 08:05:05 2016 +0100
+++ b/SmalltalkStartup.st Thu Jun 30 17:14:29 2016 +0100
@@ -64,3 +64,43 @@
"
! !
+!SmalltalkStartup class methodsFor:'startup-to be redefined'!
+
+main:argv
+
+ "/ Due to a historical reasons (see this class's comment), this
+ "/ method is called from `smalltalk.rc` startup script manually.
+ "/ Hopefully at some point we will move all the code from there
+ "/ to here. Hopefully...
+
+ | optparser unparsed |
+
+ optparser := CmdLineParser new.
+ optparser ignoreUnknownOptions: true.
+ optparser on:#('--package-path PATH') do:[:pp |
+ (pp asCollectionOfSubstringsSeparatedBy: OperatingSystem pathSeparator) reverseDo:[:e |
+ Smalltalk packagePath addFirst: e
+ ]
+ ].
+ unparsed := optparser parse: argv.
+ argv isOrderedCollection ifTrue:[
+ argv removeAll; addAll: unparsed.
+ ].
+
+ "
+ SmalltalkStartup main: #('-I' '--quick' '--package-path' '/home/some/packages') asOrderedCollection.
+ Smalltalk packagePath
+ "
+
+ "Created: / 28-06-2016 / 23:43:58 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 29-06-2016 / 18:50:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified (comment): / 30-06-2016 / 09:32:08 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!SmalltalkStartup class methodsFor:'documentation'!
+
+version_HG
+
+ ^ '$Changeset: <not expanded> $'
+! !
+
--- a/smalltalk.rc Mon Jun 27 08:05:05 2016 +0100
+++ b/smalltalk.rc Thu Jun 30 17:14:29 2016 +0100
@@ -34,10 +34,6 @@
"/***************************************************************
|cpu enableJIT|
-(Smalltalk commandLineArguments includes:'--quick') ifFalse:[
- 'smalltalk.rc [info]: initial startup (snapshot image restart is faster)...' infoPrintCR.
-].
-
"/
"/ the JIT translator is (was) known to work with the following
"/ architectures:
@@ -147,6 +143,9 @@
"/ 'systemPath: ' errorPrint. Smalltalk systemPath errorPrintCR.
Smalltalk flushPathCaches.
+
+SmalltalkStartup main: Smalltalk commandLineArguments ? #().
+
!
"/ look fore one ore more --loadPackage arguments