Commit fec559f9 authored by Petri Hintukainen's avatar Petri Hintukainen

Fix File.getLength() for relative paths

parent e7ecf8e5
......@@ -217,7 +217,20 @@ public abstract class BDFileSystem extends FileSystem {
}
public long getLength(File f) {
return fs.getLength(f);
if (f.isAbsolute()) {
return fs.getLength(f);
}
/* try to locate file in Xlet home directory */
String home = BDJXletContext.getCurrentXletHome();
if (home == null) {
logger.error("no home found for " + f.getPath() + " at " + Logger.dumpStack());
return 0;
}
String path = home + f.getPath();
logger.info("Relative path " + f.getPath() + " translated to " + path);
return fs.getLength(new File(path));
}
/*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment