Enhanced Tiled integration. ATCS offers to save a modified map before

opening in Tiled, and attempts to save a backup of the
externally-modified one when saving in ATCS if necessary.
This commit is contained in:
Zukero
2017-03-02 15:30:02 +01:00
parent 940996aa30
commit 97ae63693a
2 changed files with 25 additions and 0 deletions

View File

@@ -9,9 +9,11 @@ import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.CopyOption;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.nio.file.StandardCopyOption;
import java.util.zip.ZipEntry;
import java.util.zip.ZipOutputStream;
@@ -154,5 +156,15 @@ public class FileUtils {
}
return true;
}
public static File backupFile(File f) {
try {
Path returned = Files.copy(Paths.get(f.getAbsolutePath()), Paths.get(f.getAbsolutePath()+".bak"), StandardCopyOption.REPLACE_EXISTING);
return returned.toFile();
} catch (IOException e) {
e.printStackTrace();
}
return null;
}
}