fixed retarded bug in resource loading.

master
Ondřej Hruška 10 years ago
parent 16956fa927
commit c5fcb49e78
  1. 18
      src/mightypork/utils/files/FileUtil.java

@ -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);
}

Loading…
Cancel
Save