Skip to content

Commit e5477d9

Browse files
committed
修复更新空文件会报文件移动失败问题
1 parent 0378e8d commit e5477d9

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

src/main/java/com/github/balloonupdate/mcpatch/client/Work.java

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,13 @@ boolean run2(Servers server) throws IOException, McpatchBusinessException {
187187
}
188188
}
189189

190+
// Log.info("下载的元数据: ");
191+
// for (TempVersionMeta versionMeta : versionMetas) {
192+
// for (FileChange change : versionMeta.metadata.changes) {
193+
// Log.debug(versionMeta.metadata.label + " : " + change);
194+
// }
195+
// }
196+
190197
// 定位临时目录
191198
Path tempDir = baseDir.resolve(".mcpatch-temp");
192199

@@ -428,7 +435,7 @@ boolean run2(Servers server) throws IOException, McpatchBusinessException {
428435
// 空文件不需要下载
429436
if (f.length == 0) {
430437
Files.createFile(f.tempPath);
431-
break;
438+
continue;
432439
}
433440

434441
// 展示即将要开始下载内容

src/main/java/com/github/balloonupdate/mcpatch/client/data/FileChange.java

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ class CreateFolder implements FileChange {
1212
* 要创建目录的路径
1313
*/
1414
public String path;
15+
16+
@Override
17+
public String toString() {
18+
return "create folder: " + path;
19+
}
1520
}
1621

1722
/**
@@ -42,6 +47,11 @@ class UpdateFile implements FileChange {
4247
* 文件二进制数据在更新包中的偏移值
4348
*/
4449
public long offset;
50+
51+
@Override
52+
public String toString() {
53+
return "update file: " + path + " (" + len + ")";
54+
}
4555
}
4656

4757
/**
@@ -52,6 +62,11 @@ class DeleteFolder implements FileChange {
5262
* 要删除的目录的路径
5363
*/
5464
public String path;
65+
66+
@Override
67+
public String toString() {
68+
return "delete folder: " + path;
69+
}
5570
}
5671

5772
/**
@@ -62,6 +77,11 @@ class DeleteFile implements FileChange {
6277
* 要删除的文件的路径
6378
*/
6479
public String path;
80+
81+
@Override
82+
public String toString() {
83+
return "delete file: " + path;
84+
}
6585
}
6686

6787
/**
@@ -77,5 +97,10 @@ class MoveFile implements FileChange {
7797
* 文件到哪里去
7898
*/
7999
public String to;
100+
101+
@Override
102+
public String toString() {
103+
return "move: " + from + " => " + to;
104+
}
80105
}
81106
}

0 commit comments

Comments
 (0)