openwebbeans-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rmannibu...@apache.org
Subject svn commit: r1830907 - /openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
Date Fri, 04 May 2018 10:06:49 GMT
Author: rmannibucau
Date: Fri May  4 10:06:48 2018
New Revision: 1830907

URL: http://svn.apache.org/viewvc?rev=1830907&view=rev
Log:
trying to respect meecrowave.base properly

Modified:
    openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java

Modified: openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
URL: http://svn.apache.org/viewvc/openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java?rev=1830907&r1=1830906&r2=1830907&view=diff
==============================================================================
--- openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
(original)
+++ openwebbeans/meecrowave/trunk/meecrowave-core/src/main/java/org/apache/meecrowave/Meecrowave.java
Fri May  4 10:06:48 2018
@@ -1021,7 +1021,7 @@ public class Meecrowave implements AutoC
     }
 
     private String newBaseDir() {
-        final String dir = configuration.dir;
+        String dir = configuration.dir;
         if (dir != null) {
             final File dirFile = new File(dir);
             if (dirFile.exists()) {
@@ -1033,25 +1033,20 @@ public class Meecrowave implements AutoC
             IO.mkdirs(dirFile);
             return dirFile.getAbsolutePath();
         }
-        List<String> lookupPaths = new ArrayList<>();
-        String mw_base = System.getProperty("meecrowave.base");
-        if (mw_base != null) {
-            lookupPaths.add(new File(mw_base, "temp").getAbsolutePath());
+
+        final String base = System.getProperty("meecrowave.base");
+        if (base != null && new File(base).exists()) {
+            return new File(base).getAbsolutePath();
         }
+
+        final List<String> lookupPaths = new ArrayList<>();
         lookupPaths.add("target");
         lookupPaths.add("build");
-
-        new File(mw_base, "temp").getAbsolutePath();
-        Optional<File> baseDir = lookupPaths.stream()
-                .map(File::new)
-                .filter(File::isDirectory)
-                .findFirst();
-        File file;
-        if (baseDir.isPresent()) {
-            file = new File(baseDir.get(), "meecrowave-" + System.nanoTime());
-        } else {
-            file = ownedTempDir;
-        }
+        final File file = lookupPaths.stream()
+                          .map(File::new)
+                          .filter(File::isDirectory)
+                          .findFirst()
+                          .map(file1 -> new File(file1, "meecrowave-" + System.nanoTime())).orElse(ownedTempDir);
         IO.mkdirs(file);
         return file.getAbsolutePath();
     }



Mime
View raw message