fixed retarded bug in resource loading.

This commit is contained in:
2014-07-29 03:47:39 +02:00
parent 16956fa927
commit c5fcb49e78
+13 -5
View File
@@ -109,7 +109,7 @@ public class FileUtil {
{
try(InputStream in = new FileInputStream(source);
OutputStream out = new FileOutputStream(target)) {
OutputStream out = new FileOutputStream(target)) {
copyStream(in, out);
}
@@ -341,10 +341,18 @@ public class FileUtil {
if (in != null) return in;
try {
return new FileInputStream(WorkDir.getFile(path));
return new FileInputStream(new File(".", path));
} catch (final FileNotFoundException e) {
Log.w("Could not open resource stream: " + path);
return null;
try {
return new FileInputStream(WorkDir.getFile(path));
} catch (final FileNotFoundException e2) {
Log.w("Could not open resource stream, file not found: " + path);
return null;
}
}
}
@@ -414,7 +422,7 @@ public class FileUtil {
public static void resourceToFile(String resname, File file) throws IOException
{
try(InputStream in = FileUtil.getResource(resname);
OutputStream out = new FileOutputStream(file)) {
OutputStream out = new FileOutputStream(file)) {
FileUtil.copyStream(in, out);
}