loadImage() now tracks case sensitivity when running locally

This commit is contained in:
benfry
2005-04-14 03:34:05 +00:00
parent 91c9ecf3c8
commit 7f1fd779df
2 changed files with 42 additions and 20 deletions

View File

@@ -951,8 +951,8 @@ public class PApplet extends Applet
// note that this will not catch errors inside setup()
// those are caught by the PdeRuntime
System.out.println("exception occurred (if you don't see a stack " +
"trace below this message, we've got a bug)");
//System.out.println("exception occurred (if you don't see a stack " +
// "trace below this message, we've got a bug)");
finished = true;
exception = e;
//e.printStackTrace(System.out);
@@ -2815,9 +2815,38 @@ public class PApplet extends Applet
public InputStream openStream(String filename) {
try {
InputStream stream = null;
InputStream stream = null;
if (!online) {
try {
String location = folder + File.separator + "data";
File file = new File(location, filename);
try {
String path = file.getCanonicalPath();
String filenameActual = new File(path).getName();
//System.out.println(filename + " " + filenameActual);
if (!filenameActual.equals(filename)) {
throw new RuntimeException("This file is named " +
filenameActual + " not " +
filename + ".");
//System.err.println("This image file is named " +
// filenameActual + " not " + filename + ".");
//System.err.println("Use loadImage(\"" +
// filenameActual + "\") instead.");
//return null;
//System.out.println("found the wrong case");
//throw new RuntimeException("wrong case");
}
} catch (IOException e) { }
stream = new FileInputStream(file);
if (stream != null) return stream;
} catch (IOException e) { } // ignored
}
try {
if (filename.startsWith("http://")) {
try {
URL url = new URL(filename);
@@ -2837,14 +2866,6 @@ public class PApplet extends Applet
if (stream != null) return stream;
try {
try {
String location = folder + File.separator + "data";
File file = new File(location, filename);
stream = new FileInputStream(file);
if (stream != null) return stream;
} catch (Exception e) { } // ignored
try {
File file = new File(folder, filename);
stream = new FileInputStream(file);

View File

@@ -53,6 +53,15 @@ X Click here to visit java.com and install.
X make inverseCamera into cameraInv
X fix messages referring to depth()
X route all of them through a single function rather than current waste
X fix bezierVertex() in P3D for newer api
wednesday late
X track loadImage() with filenames that are inconsistent
X really a problem with the ves61r kids
X i.e. mixed case filename in sketch is different in windows
X but when uploaded to a unix server causes a serious problem
X use canonicalPath to flag possible problems
X http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1096508877;start=5
_ rename video.Camera to video.Video ?
_ VideoInput VideoOutput, SoundInput, SoundOutput or AudioInput/AudioOutput
@@ -63,19 +72,11 @@ _ make nf/nfs/nfp not so weird
_ nf(PLUS, ...) nf(PAD, ...) nfc(PLUS, ...)
_ should we include a from and to for the directional light?
_ fix bezierVertex() in P3D for newer api
_ fix shapes in P3D (line loop, polygons, etc)
_ fix the flicker in java2d mode
X is it because the lock was taken off (g) in PApplet?
_ track loadImage() with filenames that are inconsistent
_ really a problem with the ves61r kids
_ i.e. mixed case filename in sketch is different in windows
_ but when uploaded to a unix server causes a serious problem
_ use canonicalPath to flag possible problems
_ http://processing.org/discourse/yabb/YaBB.cgi?board=Proce55ing_software_bugs;action=display;num=1096508877;start=5
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .