compiler/cli/TCompilerCommand.st
changeset 18 e2168260b75a
parent 17 ee807ff2f897
--- a/compiler/cli/TCompilerCommand.st	Fri Sep 25 21:58:10 2015 +0100
+++ b/compiler/cli/TCompilerCommand.st	Sat Sep 26 08:59:11 2015 +0100
@@ -57,9 +57,10 @@
     super initialize.
     debugging := Transcript notNil and:[Transcript isView].    
     self setupSignalHandlers.
+    self setupPackagePath.
 
     "Created: / 06-11-2011 / 22:07:14 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 01-09-2015 / 18:42:09 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-09-2015 / 08:09:44 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
 !TCompilerCommand class methodsFor:'compiling'!
@@ -69,6 +70,13 @@
 
     | env ctx compiler units |
 
+    debugging ifTrue:[
+        Stderr nextPutLine: 'Package path:'.
+        Smalltalk packagePath do:[:each | 
+            Stderr space; space; nextPutLine: each.
+        ].
+    ].
+
     env := TEnvironment new.
     env provider classpath addAll: includes.
 
@@ -112,7 +120,7 @@
     ].
 
     "Created: / 24-09-2015 / 16:46:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
-    "Modified: / 24-09-2015 / 18:45:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+    "Modified: / 26-09-2015 / 07:52:50 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
 write: anLLVMModule as: aString
@@ -265,6 +273,22 @@
     "Created: / 27-06-2013 / 23:10:48 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 !
 
+setupPackagePath
+    | current |
+    "/ Search for package path in case of in-build (non-deployed) execution
+    current := OperatingSystem pathOfSTXExecutable asFilename directory.
+    [ current isRootDirectory ] whileFalse:[
+        (current / 'jv' / 'tea' / 'compiler' / 'cli') exists ifTrue:[ 
+            Smalltalk packagePath:
+                (Smalltalk packagePath copyWith: current pathName).
+            ^ self
+        ].
+        current := current directory.
+    ]
+
+    "Created: / 26-09-2015 / 08:09:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
 setupSignalHandlers
     "On UNIX, this sets up a custom signal handler on SIGUSR2 and SIGTERM that
      dumps stacks on all threads"