mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-25 01:57:53 +01:00
Merge pull request #3196 from thrimbor/fix_fullrender_format_change
Fix fullrender deleting the files in the new format instead of the old
This commit is contained in:
commit
d45112d60c
@ -73,15 +73,17 @@ public class FileTreeMapStorage extends MapStorage {
|
||||
}
|
||||
return ff;
|
||||
}
|
||||
private File getTileFileAltFormat() {
|
||||
private List<File> getTileFilesAltFormats() {
|
||||
ImageEncoding fmt = map.getImageFormat().getEncoding();
|
||||
if (fmt == ImageEncoding.PNG) {
|
||||
fmt = ImageEncoding.JPG;
|
||||
|
||||
List<File> files = new ArrayList<File>();
|
||||
for (ImageEncoding ie: ImageEncoding.values()) {
|
||||
if (ie != fmt) {
|
||||
files.add(getTileFile(ie));
|
||||
}
|
||||
else {
|
||||
fmt = ImageEncoding.PNG;
|
||||
}
|
||||
return getTileFile(fmt);
|
||||
|
||||
return files;
|
||||
}
|
||||
@Override
|
||||
public boolean exists() {
|
||||
@ -136,11 +138,13 @@ public class FileTreeMapStorage extends MapStorage {
|
||||
@Override
|
||||
public boolean write(long hash, BufferOutputStream encImage) {
|
||||
File ff = getTileFile(map.getImageFormat().getEncoding());
|
||||
File ffalt = getTileFileAltFormat();
|
||||
List<File> ffalt = getTileFilesAltFormats();
|
||||
File ffpar = ff.getParentFile();
|
||||
// Always clean up old alternate file, if it exsits
|
||||
if (ffalt.exists()) {
|
||||
ffalt.delete();
|
||||
// Always clean up old alternate files, if they exist
|
||||
for (File file: ffalt) {
|
||||
if (file.exists()) {
|
||||
file.delete();
|
||||
}
|
||||
}
|
||||
if (encImage == null) { // Delete?
|
||||
ff.delete();
|
||||
|
Loading…
Reference in New Issue
Block a user