mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-18 03:38:01 +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.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -154,19 +155,36 @@ public final class SLayoutIO {
|
||||
fis = new FileInputStream(file.defaultLoc);
|
||||
}
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
XMLEventReader xer = null;
|
||||
try {
|
||||
model = readLayout(inputFactory.createXMLEventReader(fis));
|
||||
xer = inputFactory.createXMLEventReader(fis);
|
||||
model = readLayout(xer);
|
||||
} 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
|
||||
throw new InvalidLayoutFileException();
|
||||
else
|
||||
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
|
||||
DragCell cell = null;
|
||||
for(Entry<RectangleOfDouble, Collection<EDocID>> kv : model.entrySet()) {
|
||||
|
||||
Reference in New Issue
Block a user