mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
fix for url stuff on openStream
This commit is contained in:
+12
-12
@@ -3033,6 +3033,18 @@ public class PApplet extends Applet
|
||||
public InputStream openStream(String filename) {
|
||||
InputStream stream = null;
|
||||
|
||||
try {
|
||||
URL url = new URL(filename);
|
||||
stream = url.openStream();
|
||||
return stream;
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
// not a url, that's fine
|
||||
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException("Error downloading from URL " + filename);
|
||||
}
|
||||
|
||||
if (!online) {
|
||||
try {
|
||||
String location = folder + File.separator + "data";
|
||||
@@ -3063,18 +3075,6 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
try {
|
||||
if (filename.startsWith("http://")) {
|
||||
try {
|
||||
URL url = new URL(filename);
|
||||
stream = url.openStream();
|
||||
return stream;
|
||||
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
stream = getClass().getResourceAsStream(filename);
|
||||
if (stream != null) return stream;
|
||||
|
||||
|
||||
@@ -133,6 +133,10 @@ o make nf/nfs/nfp not so weird
|
||||
o nf(PLUS, ...) nf(PAD, ...) nfc(PLUS, ...)
|
||||
X unhex was broken for numbers bigger than 2^31
|
||||
|
||||
saturday late afternoon
|
||||
X fix bug with openStream() and upper/lowercase stuff
|
||||
X do a better job of handling any kind of URLs in openStream()
|
||||
|
||||
|
||||
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
|
||||
|
||||
|
||||
Reference in New Issue
Block a user