Fix fullrender deleting the files in the new format instead of the old
This commit is contained in:
parent
3ff0d632a2
commit
53c42894bf
1 changed files with 15 additions and 11 deletions
|
|
@ -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 files;
|
||||||
}
|
|
||||||
return getTileFile(fmt);
|
|
||||||
}
|
}
|
||||||
@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…
Add table
Add a link
Reference in a new issue