mirror of
https://github.com/webbukkit/dynmap.git
synced 2024-12-25 18:17:37 +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;
|
return ff;
|
||||||
}
|
}
|
||||||
private File getTileFileAltFormat() {
|
private List<File> getTileFilesAltFormats() {
|
||||||
ImageEncoding fmt = map.getImageFormat().getEncoding();
|
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
|
@Override
|
||||||
public boolean exists() {
|
public boolean exists() {
|
||||||
@ -136,11 +138,13 @@ public class FileTreeMapStorage extends MapStorage {
|
|||||||
@Override
|
@Override
|
||||||
public boolean write(long hash, BufferOutputStream encImage) {
|
public boolean write(long hash, BufferOutputStream encImage) {
|
||||||
File ff = getTileFile(map.getImageFormat().getEncoding());
|
File ff = getTileFile(map.getImageFormat().getEncoding());
|
||||||
File ffalt = getTileFileAltFormat();
|
List<File> ffalt = getTileFilesAltFormats();
|
||||||
File ffpar = ff.getParentFile();
|
File ffpar = ff.getParentFile();
|
||||||
// Always clean up old alternate file, if it exsits
|
// Always clean up old alternate files, if they exist
|
||||||
if (ffalt.exists()) {
|
for (File file: ffalt) {
|
||||||
ffalt.delete();
|
if (file.exists()) {
|
||||||
|
file.delete();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (encImage == null) { // Delete?
|
if (encImage == null) { // Delete?
|
||||||
ff.delete();
|
ff.delete();
|
||||||
|
Loading…
Reference in New Issue
Block a user