git://source.jalview.org
/
jalview.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
JAL-629 Change --open to --append and --opennew to --open. Make --open(new) part...
[jalview.git]
/
src
/
jalview
/
util
/
FileUtils.java
diff --git
a/src/jalview/util/FileUtils.java
b/src/jalview/util/FileUtils.java
index
b6f4e90
..
4d35cd2
100644
(file)
--- a/
src/jalview/util/FileUtils.java
+++ b/
src/jalview/util/FileUtils.java
@@
-12,6
+12,7
@@
import java.nio.file.Paths;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.EnumSet;
import java.util.List;
import java.util.stream.Collectors;
import java.util.EnumSet;
import java.util.List;
import java.util.stream.Collectors;
@@
-67,10
+68,11
@@
public class FileUtils
String glob = "glob:" + parentDir.toString() + File.separator
+ rest;
PathMatcher pm = FileSystems.getDefault().getPathMatcher(glob);
String glob = "glob:" + parentDir.toString() + File.separator
+ rest;
PathMatcher pm = FileSystems.getDefault().getPathMatcher(glob);
- int maxDepth = rest.contains("**") ? Integer.MAX_VALUE
+ int maxDepth = rest.contains("**") ? 1028
: (int) (rest.chars()
.filter(ch -> ch == File.separatorChar).count())
+ 1;
: (int) (rest.chars()
.filter(ch -> ch == File.separatorChar).count())
+ 1;
+
Files.walkFileTree(parentDir,
EnumSet.of(FileVisitOption.FOLLOW_LINKS), maxDepth,
new SimpleFileVisitor<Path>()
Files.walkFileTree(parentDir,
EnumSet.of(FileVisitOption.FOLLOW_LINKS), maxDepth,
new SimpleFileVisitor<Path>()
@@
-108,6
+110,7
@@
public class FileUtils
files.add(f);
}
}
files.add(f);
}
}
+ Collections.sort(files);
return files;
}
return files;
}
@@
-127,7
+130,7
@@
public class FileUtils
}
/*
}
/*
- * This method returns the basename of the first --open or --opennew value.
+ * This method returns the basename of the first --append or --open value.
* Used primarily for substitutions in output filenames.
*/
public static String getBasename(File file)
* Used primarily for substitutions in output filenames.
*/
public static String getBasename(File file)
@@
-150,7
+153,7
@@
public class FileUtils
}
/*
}
/*
- * This method returns the dirname of the first --open or --opennew value.
+ * This method returns the dirname of the first --append or --open value.
* Used primarily for substitutions in output filenames.
*/
public static String getDirname(File file)
* Used primarily for substitutions in output filenames.
*/
public static String getDirname(File file)
@@
-161,7
+164,9
@@
public class FileUtils
String dirname = null;
try
{
String dirname = null;
try
{
- dirname = file.getParentFile().getCanonicalPath();
+ File p = file.getParentFile();
+ File d = new File(substituteHomeDir(p.getPath()));
+ dirname = d.getCanonicalPath();
} catch (IOException e)
{
Console.debug(
} catch (IOException e)
{
Console.debug(