File tree Expand file tree Collapse file tree
src/main/java/com/github/balloonupdate/mcpatch/client/selfupdate Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ public static void createUpdateMarker(Path newJarPath) throws Exception {
163163 content .append ("path=" ).append (newJarPath .toAbsolutePath ()).append ("\n " );
164164 content .append ("time=" ).append (System .currentTimeMillis ()).append ("\n " );
165165
166- Files .writeString (markerFile , content .toString ());
166+ Files .write (markerFile , content .toString (). getBytes ());
167167
168168 Log .debug ("已创建更新标记文件: " + markerFile );
169169 }
Original file line number Diff line number Diff line change 77import java .io .StringReader ;
88import java .nio .file .Files ;
99import java .nio .file .Path ;
10+ import java .nio .file .Paths ;
1011import java .nio .file .StandardCopyOption ;
1112
1213/**
@@ -34,7 +35,7 @@ public static boolean installPendingUpdate() {
3435 Log .debug ("读取标记文件: " + markerFile );
3536
3637 // 解析标记文件
37- String markerContent = Files .readString (markerFile );
38+ String markerContent = new String ( Files .readAllBytes (markerFile ) );
3839 Path newJarPath = parseMarkerFile (markerContent );
3940
4041 if (newJarPath == null ) {
@@ -113,15 +114,15 @@ private static Path parseMarkerFile(String content) {
113114
114115 while ((line = reader .readLine ()) != null ) {
115116 if (line .startsWith ("path=" )) {
116- jarPath = Path . of (line .substring (5 ).trim ());
117+ jarPath = Paths . get (line .substring (5 ).trim ());
117118 }
118119 }
119120
120121 // 如果没有 path= 格式,尝试直接作为路径解析(旧格式兼容)
121122 if (jarPath == null && !content .trim ().isEmpty ()) {
122123 String firstLine = content .split ("\n " )[0 ].trim ();
123124 if (!firstLine .isEmpty ()) {
124- jarPath = Path . of (firstLine );
125+ jarPath = Paths . get (firstLine );
125126 }
126127 }
127128
You can’t perform that action at this time.
0 commit comments