mirror of
https://github.com/processing/processing4.git
synced 2026-02-11 09:39:19 +01:00
savePath() and createPath() plus some misc
This commit is contained in:
@@ -129,6 +129,8 @@ export CLASSPATH
|
||||
|
||||
perl preproc.pl
|
||||
../build/windows/work/jikes -d . +D -target 1.1 *.java
|
||||
# use this from time to time to test 1.1 savviness
|
||||
#/cygdrive/c/msjdk-4.0/bin/jvc /d . *.java
|
||||
zip -rq ../build/windows/work/lib/core.jar processing
|
||||
|
||||
#perl make.pl JIKES=../build/windows/work/jikes JDK13
|
||||
|
||||
@@ -1149,7 +1149,7 @@ public class PApplet extends Applet
|
||||
}
|
||||
|
||||
//File file = new File(folder, "screen-" + nf(frame, 4) + ".tif");
|
||||
save(save_location("screen-" + nf(frameCount, 4) + ".tif", true));
|
||||
save(savePath("screen-" + nf(frameCount, 4) + ".tif"));
|
||||
//save("screen-" + nf(frame, 4) + ".tif");
|
||||
}
|
||||
|
||||
@@ -1185,7 +1185,7 @@ public class PApplet extends Applet
|
||||
// in case the user tries to make subdirs with the filename
|
||||
//new File(file.getParent()).mkdirs();
|
||||
//save(file.getAbsolutePath());
|
||||
save(save_location(prefix + nf(frameCount, count) + suffix, true));
|
||||
save(savePath(prefix + nf(frameCount, count) + suffix));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2116,7 +2116,7 @@ public class PApplet extends Applet
|
||||
*/
|
||||
public PrintWriter writer(String filename) {
|
||||
try {
|
||||
return writer(new FileOutputStream(save_location(filename, true)));
|
||||
return writer(new FileOutputStream(savePath(filename)));
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
@@ -2298,7 +2298,7 @@ public class PApplet extends Applet
|
||||
*/
|
||||
public void saveBytes(String filename, byte buffer[]) {
|
||||
try {
|
||||
String location = save_location(filename, true);
|
||||
String location = savePath(filename);
|
||||
FileOutputStream fos = new FileOutputStream(location);
|
||||
saveBytes(fos, buffer);
|
||||
fos.close();
|
||||
@@ -2314,8 +2314,9 @@ public class PApplet extends Applet
|
||||
*/
|
||||
public void saveBytes(File file, byte buffer[]) {
|
||||
try {
|
||||
String filename = save_location(file.getAbsolutePath(), false);
|
||||
FileOutputStream fos = new FileOutputStream(filename);
|
||||
String filename = file.getAbsolutePath();
|
||||
createPath(filename);
|
||||
FileOutputStream fos = new FileOutputStream(file);
|
||||
saveBytes(fos, buffer);
|
||||
fos.close();
|
||||
|
||||
@@ -2344,7 +2345,7 @@ public class PApplet extends Applet
|
||||
|
||||
public void saveStrings(String filename, String strings[]) {
|
||||
try {
|
||||
String location = save_location(filename, true);
|
||||
String location = savePath(filename);
|
||||
FileOutputStream fos = new FileOutputStream(location);
|
||||
saveStrings(fos, strings);
|
||||
fos.close();
|
||||
@@ -2358,7 +2359,8 @@ public class PApplet extends Applet
|
||||
|
||||
public void saveStrings(File file, String strings[]) {
|
||||
try {
|
||||
String location = save_location(file.getAbsolutePath(), false);
|
||||
String location = file.getAbsolutePath();
|
||||
createPath(location);
|
||||
FileOutputStream fos = new FileOutputStream(location);
|
||||
saveStrings(fos, strings);
|
||||
fos.close();
|
||||
@@ -2378,24 +2380,30 @@ public class PApplet extends Applet
|
||||
writer.flush();
|
||||
}
|
||||
|
||||
|
||||
//
|
||||
|
||||
|
||||
/**
|
||||
* figures out the full path for where to save things
|
||||
* if 'sketch' is true, then the path will be relative to
|
||||
* the sketch folder. creates in-between folders if they
|
||||
* don't already exist.
|
||||
* Figures out the full path for where to save things.
|
||||
* Can be used by external libraries to save to the sketch folder.
|
||||
*/
|
||||
protected String save_location(String where, boolean sketch) {
|
||||
String filename =
|
||||
sketch ? (folder + File.separator + where) : where;
|
||||
public String savePath(String where) {
|
||||
String filename = folder + File.separator + where;
|
||||
createPath(filename);
|
||||
return filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates in-between folders if they don't already exist.
|
||||
*/
|
||||
static public void createPath(String filename) {
|
||||
File file = new File(filename);
|
||||
String parent = file.getParent();
|
||||
if (parent != null) {
|
||||
File unit = new File(parent);
|
||||
if (!unit.exists()) unit.mkdirs();
|
||||
}
|
||||
return filename;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -200,6 +200,10 @@ X get library stuff debugged
|
||||
X port arcball and finish up dxf writer
|
||||
X beginCamera() no longer sets an identity matrix
|
||||
|
||||
040925
|
||||
X make savePath() and createPath() accessible to the outside world
|
||||
X useful for libraries saving files etc.
|
||||
|
||||
_ before graphics engine change, attach jogl stuff?
|
||||
_ massive graphics engine changes
|
||||
_ explicitly state depth()/nodepth()
|
||||
|
||||
3
todo.txt
3
todo.txt
@@ -116,6 +116,9 @@ sure if related. same for PATH and CLASSPATH.
|
||||
* some virus scanning software, particularly older NAV versions cause
|
||||
the trouble.
|
||||
|
||||
_ remove fonts from distribution
|
||||
_ fix dist.sh for mac, pc, linux
|
||||
|
||||
_ be able to link against, but not export, certain parts of lib
|
||||
_ jsyn.jar not needed on export, netscape libs not needed on export
|
||||
_ netscape.javascript not properly working in 1.4
|
||||
|
||||
Reference in New Issue
Block a user