Fix primitive paths during compilation on Windows.

Change-Id: Ic1be471e4f322652fa55274733d20531b66a82dc
diff --git a/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/api/impl/TigerstripePhantomProjectHandle.java b/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/api/impl/TigerstripePhantomProjectHandle.java
index b974821..79db765 100644
--- a/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/api/impl/TigerstripePhantomProjectHandle.java
+++ b/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/api/impl/TigerstripePhantomProjectHandle.java
@@ -28,6 +28,7 @@
 import javax.tools.StandardJavaFileManager;
 import javax.tools.ToolProvider;
 
+import org.apache.commons.lang.StringUtils;
 import org.apache.tools.ant.DirectoryScanner;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.NullProgressMonitor;
@@ -202,9 +203,7 @@
 
         classesDir.mkdirs();
 
-        String outputDir = projectDir + File.separator + classes;
-        
-        List<String> compilerArgs = new ArrayList<>();
+        String outputDir = classesDir.getAbsolutePath();
         
         // Add all artifacts from the src dir
         DirectoryScanner scanner = new DirectoryScanner();
@@ -217,29 +216,18 @@
         scanner.scan();
         String[] files = scanner.getIncludedFiles();
 
-        List<File> filesToCompile = new ArrayList<>();
-
-        for (int j = 0; j < files.length; j++) {
-            if (!"".equals(files[j])) {
-
-                // TODO - Had to edit this .....
-
-                filesToCompile.add(new File (projectDir + File.separator 
-                        + files[j]));
-                
-                compilerArgs.add(projectDir + File.separator
-                        + files[j]);
-                
-            }
-        }
-
-
         // Try and compile
-
         if (runtime.getRuntype() == NewTigerstripeRuntime.CLI_RUN
                 || runtime.getRuntype() == NewTigerstripeRuntime.ANT_RUN 
                 || runtime.getRuntype() == NewTigerstripeRuntime.STANDALONE_RUN ) {
 
+            List<File> filesToCompile = new ArrayList<>();
+            for (String filePath : files) {
+                if (StringUtils.isNotEmpty(filePath)) {
+                    filesToCompile.add(new File (projectDir, filePath));
+                }
+            }
+
             // We are not inside eclipse, so use the system compiler
             try {
 
@@ -250,13 +238,14 @@
                         fileManager.getJavaFileObjectsFromFiles(filesToCompile);
 
                 final Iterable<String> options = Arrays.asList("-d", outputDir);
-                Boolean result = compiler.getTask(null, null, null, options, null, compilationUnits).call();
+                Boolean compileResult = compiler.getTask(null, null, null, options, null, compilationUnits).call();
 
                 fileManager.close();
 
-                if (!result)
+                if (!compileResult.booleanValue()) {
                     throw new TigerstripeException(
                             CouldntCompilePhantomProjectContent);
+                }
 
             } catch (Exception  e) {
                 runtime
@@ -276,6 +265,13 @@
             try {
                
                 // Assemble proper command line for compile
+
+                List<String> compilerArgs = new ArrayList<>();
+                for (String filePath : files) {
+                    if (StringUtils.isNotEmpty(filePath)) {
+                        compilerArgs.add(new File (projectDir, filePath).getAbsolutePath());
+                    }
+                }
                 compilerArgs.add("-d");
                 compilerArgs.add(outputDir);
                 
diff --git a/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/core/NewTigerstripeRuntime.java b/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/core/NewTigerstripeRuntime.java
index 8d4f549..26887de 100644
--- a/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/core/NewTigerstripeRuntime.java
+++ b/core/org.eclipse.tigerstripe.core/src/main/java/org/eclipse/tigerstripe/workbench/internal/core/NewTigerstripeRuntime.java
@@ -372,25 +372,19 @@
         return getTigerstripeRuntimeRoot();

     }

 

-    public synchronized void init(String ts_home) {

+    public synchronized void init(String ts_home) throws TigerstripeException {

         if (!initialized) {

+            setTs_home(ts_home);

+            File tigerstripeRuntimeRootFile = getOrCreateTigerstripeRuntimeDir();

+            setTigerstripeRuntime(tigerstripeRuntimeRootFile.getAbsolutePath());

+            getOrCreateTigerstripePluginDir();

+            getOrCreateTigerstripeModulesDir();

+            initLogger();

 

-            try {

-                setTs_home(ts_home);

-                File tigerstripeRuntimeRootFile = getOrCreateTigerstripeRuntimeDir();

-                setTigerstripeRuntime(tigerstripeRuntimeRootFile.getAbsolutePath());

-                getOrCreateTigerstripePluginDir();

-                getOrCreateTigerstripeModulesDir();

-                initLogger();

-    

-                classpathModuleManager = new ClasspathModuleManager(this);

-                

-                initialized = true;

-                

-                getPhantomTigerstripeProjectMgr().getPhantomProject();

-            } catch (TigerstripeException e) {

-                logErrorMessage("Tigerstripe has encountered a critical error during post-startup initialization", e);

-            }

+            classpathModuleManager = new ClasspathModuleManager(this);

+            initialized = true;

+            // Force initialization of the phantom project to load the primitive classes

+            getPhantomTigerstripeProjectMgr().getPhantomProject();

         }

     }