run java mode when large data folder is in use

This commit is contained in:
benfry
2004-07-12 22:07:13 +00:00
parent a990356062
commit a90ed095c3

View File

@@ -855,23 +855,6 @@ public class PdeSketch {
// better connected to the dataFolder stuff below.
cleanup();
// copy contents of data dir into lib/build
// TODO write a file sync procedure here.. if the files
// already exist in the target, or haven't been modified
// don't' bother. this can waste a lot of time when running.
//File dataDir = new File(folder, "data");
if (dataFolder.exists()) {
// just drop the files in the build folder (pre-68)
//PdeBase.copyDir(dataDir, buildDir);
// drop the files into a 'data' subfolder of the build dir
try {
PdeBase.copyDir(dataFolder, new File(tempBuildFolder, "data"));
} catch (IOException e) {
e.printStackTrace();
throw new PdeException("Problem copying files from data folder");
}
}
// make up a temporary class name to suggest.
// name will only be used if the code is not in ADVANCED mode.
String suggestedClassName =
@@ -882,6 +865,21 @@ public class PdeSketch {
mainClassName = build(TEMP_BUILD_PATH, suggestedClassName);
// externalPaths is magically set by build()
if (!externalRuntime) { // only if not running externally already
// copy contents of data dir into lib/build
if (dataFolder.exists()) {
// just drop the files in the build folder (pre-68)
//PdeBase.copyDir(dataDir, buildDir);
// drop the files into a 'data' subfolder of the build dir
try {
PdeBase.copyDir(dataFolder, new File(tempBuildFolder, "data"));
} catch (IOException e) {
e.printStackTrace();
throw new PdeException("Problem copying files from data folder");
}
}
}
// if the compilation worked, run the applet
// if (mainClassName != null) {
@@ -986,6 +984,11 @@ public class PdeSketch {
libraryPath = "";
}
// if 'data' folder is large, set to external runtime
if (PdeBase.calcFolderSize(dataFolder) > 768 * 1024) { // if > 768k
externalRuntime = true;
}
// first run preproc on the 'main' file, using the sugg class name
// then for code 1..count
// if .java, write programs[i] to buildpath