X-Git-Url: http://git.nikiroo.be/?p=fanfix.git;a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Ffanfix%2Fsupported%2FBasicSupport.java;h=b230bc3252e249caf57560b9c394cefa5fd135f8;hp=0ee12fec463cef8b1c6dd31093ad2401c9ef4587;hb=2ab2e40a2bbee89b7f1ddf7d916268c50fcbb9f1;hpb=a8872189e2725388cb9e6f43fcdec5ebe6e78342 diff --git a/src/be/nikiroo/fanfix/supported/BasicSupport.java b/src/be/nikiroo/fanfix/supported/BasicSupport.java index 0ee12fe..b230bc3 100644 --- a/src/be/nikiroo/fanfix/supported/BasicSupport.java +++ b/src/be/nikiroo/fanfix/supported/BasicSupport.java @@ -874,19 +874,35 @@ public abstract class BasicSupport { if (line != null) { // try for files - String path = null; if (source != null) { - path = new File(source.getFile()).getParent(); try { - String basePath = new File(new File(path), line.trim()) - .getAbsolutePath(); + + String relPath = null; + String absPath = null; + try { + String path = new File(source.getFile()).getParent(); + relPath = new File(new File(path), line.trim()) + .getAbsolutePath(); + } catch (Exception e) { + // Cannot be converted to path (one possibility to take + // into account: absolute path on Windows) + } + try { + absPath = new File(line.trim()).getAbsolutePath(); + } catch (Exception e) { + // Cannot be converted to path (at all) + } + for (String ext : getImageExt(true)) { - if (new File(basePath + ext).exists()) { - url = new File(basePath + ext).toURI().toURL(); + if (absPath != null && new File(absPath + ext).exists()) { + url = new File(absPath + ext).toURI().toURL(); + } else if (relPath != null + && new File(relPath + ext).exists()) { + url = new File(relPath + ext).toURI().toURL(); } } } catch (Exception e) { - // Nothing to do here + // Should not happen since we control the correct arguments } }