From e97ae2f4b0cd1aab6b4422dab519c648ab9663f2 Mon Sep 17 00:00:00 2001 From: bkuker Date: Wed, 12 Dec 2012 14:46:18 -0500 Subject: [PATCH] If an absolute file is missing try resolving it in the directory the file was loaded from --- core/src/net/sf/openrocket/document/DecalRegistry.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/core/src/net/sf/openrocket/document/DecalRegistry.java b/core/src/net/sf/openrocket/document/DecalRegistry.java index f3d2f8dbe..4a7c3b4b1 100644 --- a/core/src/net/sf/openrocket/document/DecalRegistry.java +++ b/core/src/net/sf/openrocket/document/DecalRegistry.java @@ -15,10 +15,13 @@ import java.util.zip.ZipEntry; import java.util.zip.ZipInputStream; import net.sf.openrocket.file.FileInfo; +import net.sf.openrocket.logging.LogHelper; +import net.sf.openrocket.startup.Application; import net.sf.openrocket.util.BugException; import net.sf.openrocket.util.FileUtils; public class DecalRegistry { + private static LogHelper log = Application.getLogger(); private FileInfo fileInfo; private boolean isZipFile = false; @@ -105,7 +108,12 @@ public class DecalRegistry { if ( rawIs == null ) { File decal = new File(name); if ( decal.isAbsolute() ) { - rawIs = new FileInputStream(decal); + try { + rawIs = new FileInputStream(decal); + } catch ( FileNotFoundException e ){ + name = decal.getName(); + log.debug("Unable to find absolute file" + decal + ", falling back to " + name); + } } }