mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 11:48:02 +00:00
file deletion now works
This commit is contained in:
@@ -5,6 +5,7 @@ import java.io.File;
|
|||||||
import java.io.FileInputStream;
|
import java.io.FileInputStream;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -154,19 +155,36 @@ public final class SLayoutIO {
|
|||||||
fis = new FileInputStream(file.defaultLoc);
|
fis = new FileInputStream(file.defaultLoc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
XMLEventReader xer = null;
|
||||||
try {
|
try {
|
||||||
model = readLayout(inputFactory.createXMLEventReader(fis));
|
xer = inputFactory.createXMLEventReader(fis);
|
||||||
|
model = readLayout(xer);
|
||||||
} catch (final XMLStreamException e) {
|
} catch (final XMLStreamException e) {
|
||||||
|
try {
|
||||||
|
if ( xer != null ) xer.close();
|
||||||
|
} catch (final XMLStreamException x) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
e.printStackTrace();
|
||||||
if ( usedCustomPrefsFile ) // the one we can safely delete
|
if ( usedCustomPrefsFile ) // the one we can safely delete
|
||||||
throw new InvalidLayoutFileException();
|
throw new InvalidLayoutFileException();
|
||||||
else
|
else
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} finally {
|
||||||
|
if ( fis != null )
|
||||||
|
try {
|
||||||
|
fis.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Apply new layout
|
// Apply new layout
|
||||||
DragCell cell = null;
|
DragCell cell = null;
|
||||||
for(Entry<RectangleOfDouble, Collection<EDocID>> kv : model.entrySet()) {
|
for(Entry<RectangleOfDouble, Collection<EDocID>> kv : model.entrySet()) {
|
||||||
|
|||||||
Reference in New Issue
Block a user