Skip to content

Commit

Permalink
修复路径排序
Browse files Browse the repository at this point in the history
  • Loading branch information
Glavo committed Jun 17, 2021
1 parent 8029919 commit 104cd5b
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ English documents are not available, welcome to contribute.

(English help is available, please execute `gcheck -- help` to view)


w
一个简单的文件夹校验工具,用于为文件夹下所有文件生成哈希码并保存到文件,
以及使用保存的哈希码对文件夹内容进行校验。

支持并默认使用并发校验
默认使用并发校验

简单用法:
```
Expand Down
2 changes: 1 addition & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ plugins {
}

group = "org.glavo"
version = "0.5.0" + "-SNAPSHOT"
version = "0.5.0" //+ "-SNAPSHOT"

val mainName = "org.glavo.checksum.Main"

Expand Down
17 changes: 8 additions & 9 deletions src/main/java/org/glavo/checksum/Main.java
Original file line number Diff line number Diff line change
Expand Up @@ -367,17 +367,16 @@ private static abstract class FTW<T> implements FileVisitor<Path> {
private final TreeMap<String[], T> result = new TreeMap<>((x, y) -> {
final int xLength = x.length;
final int yLength = y.length;
int c = Integer.compare(xLength, yLength);
if (c != 0) {
return c;
}
for (int i = 0; i < xLength; i++) {
c = x[i].compareTo(y[i]);
if (c != 0) {
return c;

int length = Math.min(xLength, yLength);
for (int i = 0; i < length; i++) {
int v = x[i].compareTo(y[i]);
if (v != 0) {
return v;
}
}
return 0;

return xLength - yLength;
});

private final Path exclude;
Expand Down

0 comments on commit 104cd5b

Please sign in to comment.