equal
deleted
inserted
replaced
218 write_xz(path.file, text, options) |
218 write_xz(path.file, text, options) |
219 def write_xz(path: Path, text: CharSequence): Unit = write_xz(path, text, XZ.options()) |
219 def write_xz(path: Path, text: CharSequence): Unit = write_xz(path, text, XZ.options()) |
220 |
220 |
221 def write_backup(path: Path, text: CharSequence) |
221 def write_backup(path: Path, text: CharSequence) |
222 { |
222 { |
223 if (path.is_file) mv(path, path.backup) |
223 if (path.is_file) move(path, path.backup) |
224 write(path, text) |
224 write(path, text) |
225 } |
225 } |
226 |
226 |
227 def write_backup2(path: Path, text: CharSequence) |
227 def write_backup2(path: Path, text: CharSequence) |
228 { |
228 { |
229 if (path.is_file) mv(path, path.backup2) |
229 if (path.is_file) move(path, path.backup2) |
230 write(path, text) |
230 write(path, text) |
231 } |
231 } |
232 |
232 |
233 |
233 |
234 /* append */ |
234 /* append */ |
263 def copy(path1: Path, path2: Path): Unit = copy(path1.file, path2.file) |
263 def copy(path1: Path, path2: Path): Unit = copy(path1.file, path2.file) |
264 |
264 |
265 |
265 |
266 /* move */ |
266 /* move */ |
267 |
267 |
268 def mv(file1: JFile, file2: JFile): Unit = |
268 def move(src: JFile, dst: JFile) |
269 Files.move(file1.toPath, file2.toPath, StandardCopyOption.REPLACE_EXISTING) |
269 { |
270 |
270 val target = if (dst.isDirectory) new JFile(dst, src.getName) else dst |
271 def mv(path1: Path, path2: Path): Unit = mv(path1.file, path2.file) |
271 if (!eq(src, target)) |
|
272 Files.move(src.toPath, target.toPath, StandardCopyOption.REPLACE_EXISTING) |
|
273 } |
|
274 |
|
275 def move(path1: Path, path2: Path): Unit = move(path1.file, path2.file) |
272 } |
276 } |