Skip to content

Commit 0edcc2b

Browse files
committed
handle movements from Base to Util
1 parent 0a1e69f commit 0edcc2b

File tree

2 files changed

+22
-20
lines changed

2 files changed

+22
-20
lines changed

src/processing/mode/android/AndroidBuild.java

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
import processing.app.Preferences;
3232
import processing.app.Sketch;
3333
import processing.app.SketchException;
34+
import processing.app.Util;
3435
import processing.app.exec.ProcessHelper;
3536
import processing.app.exec.ProcessResult;
3637
import processing.core.PApplet;
@@ -178,7 +179,7 @@ public File createProject() throws IOException, SketchException {
178179

179180
// InputStream input = PApplet.createInput(getCoreZipLocation());
180181
// PApplet.saveStream(new File(libsFolder, "processing-core.jar"), input);
181-
Base.copyFile(coreZipFile, new File(libsFolder, "processing-core.jar"));
182+
Util.copyFile(coreZipFile, new File(libsFolder, "processing-core.jar"));
182183

183184
// Copy any imported libraries (their libs and assets),
184185
// and anything in the code folder contents to the project.
@@ -188,14 +189,14 @@ public File createProject() throws IOException, SketchException {
188189
// Copy the data folder (if one exists) to the project's 'assets' folder
189190
final File sketchDataFolder = sketch.getDataFolder();
190191
if (sketchDataFolder.exists()) {
191-
Base.copyDir(sketchDataFolder, assetsFolder);
192+
Util.copyDir(sketchDataFolder, assetsFolder);
192193
}
193194

194195
// Do the same for the 'res' folder.
195196
// http://code.google.com/p/processing/issues/detail?id=767
196197
final File sketchResFolder = new File(sketch.getFolder(), "res");
197198
if (sketchResFolder.exists()) {
198-
Base.copyDir(sketchResFolder, resFolder);
199+
Util.copyDir(sketchResFolder, resFolder);
199200
}
200201
}
201202
return tmpFolder;
@@ -282,7 +283,7 @@ public File exportProject() throws IOException, SketchException {
282283
File projectFolder = createProject();
283284
if (projectFolder != null) {
284285
File exportFolder = createExportFolder();
285-
Base.copyDir(projectFolder, exportFolder);
286+
Util.copyDir(projectFolder, exportFolder);
286287
return exportFolder;
287288
}
288289
return null;
@@ -296,7 +297,7 @@ public File exportPackage(String keyStorePassword) throws Exception {
296297
if (signedPackage == null) return null;
297298

298299
File exportFolder = createExportFolder();
299-
Base.copyDir(projectFolder, exportFolder);
300+
Util.copyDir(projectFolder, exportFolder);
300301
return new File(exportFolder, "/bin/");
301302
}
302303

@@ -789,22 +790,22 @@ private void writeRes(File resFolder,
789790
try {
790791
// if no icons are in the sketch folder, then copy all the defaults
791792
if (buildIcon36.getParentFile().mkdirs()) {
792-
Base.copyFile(mode.getContentFile("icons/" + ICON_36), buildIcon36);
793+
Util.copyFile(mode.getContentFile("icons/" + ICON_36), buildIcon36);
793794
} else {
794795
System.err.println("Could not create \"drawable-ldpi\" folder.");
795796
}
796797
if (buildIcon48.getParentFile().mkdirs()) {
797-
Base.copyFile(mode.getContentFile("icons/" + ICON_48), buildIcon48);
798+
Util.copyFile(mode.getContentFile("icons/" + ICON_48), buildIcon48);
798799
} else {
799800
System.err.println("Could not create \"drawable\" folder.");
800801
}
801802
if (buildIcon72.getParentFile().mkdirs()) {
802-
Base.copyFile(mode.getContentFile("icons/" + ICON_72), buildIcon72);
803+
Util.copyFile(mode.getContentFile("icons/" + ICON_72), buildIcon72);
803804
} else {
804805
System.err.println("Could not create \"drawable-hdpi\" folder.");
805806
}
806807
if (buildIcon96.getParentFile().mkdirs()) {
807-
Base.copyFile(mode.getContentFile("icons/" + ICON_96), buildIcon96);
808+
Util.copyFile(mode.getContentFile("icons/" + ICON_96), buildIcon96);
808809
} else {
809810
System.err.println("Could not create \"drawable-xhdpi\" folder.");
810811
}
@@ -817,22 +818,22 @@ private void writeRes(File resFolder,
817818
try {
818819
if (localIcon36.exists()) {
819820
if (new File(resFolder, "drawable-ldpi").mkdirs()) {
820-
Base.copyFile(localIcon36, buildIcon36);
821+
Util.copyFile(localIcon36, buildIcon36);
821822
}
822823
}
823824
if (localIcon48.exists()) {
824825
if (new File(resFolder, "drawable").mkdirs()) {
825-
Base.copyFile(localIcon48, buildIcon48);
826+
Util.copyFile(localIcon48, buildIcon48);
826827
}
827828
}
828829
if (localIcon72.exists()) {
829830
if (new File(resFolder, "drawable-hdpi").mkdirs()) {
830-
Base.copyFile(localIcon72, buildIcon72);
831+
Util.copyFile(localIcon72, buildIcon72);
831832
}
832833
}
833834
if (localIcon96.exists()) {
834835
if (new File(resFolder, "drawable-xhdpi").mkdirs()) {
835-
Base.copyFile(localIcon96, buildIcon96);
836+
Util.copyFile(localIcon96, buildIcon96);
836837
}
837838
}
838839
} catch (IOException e) {
@@ -903,24 +904,24 @@ private void copyLibraries(final File libsFolder,
903904
if (exportName.equals("armeabi") ||
904905
exportName.equals("armeabi-v7a") ||
905906
exportName.equals("x86")) {
906-
Base.copyDir(exportFile, new File(libsFolder, exportName));
907+
Util.copyDir(exportFile, new File(libsFolder, exportName));
907908
} else {
908909
// Copy any other directory to the assets folder
909-
Base.copyDir(exportFile, new File(assetsFolder, exportName));
910+
Util.copyDir(exportFile, new File(assetsFolder, exportName));
910911
}
911912
} else if (exportName.toLowerCase().endsWith(".zip")) {
912913
// As of r4 of the Android SDK, it looks like .zip files
913914
// are ignored in the libs folder, so rename to .jar
914915
System.err.println(".zip files are not allowed in Android libraries.");
915916
System.err.println("Please rename " + exportFile.getName() + " to be a .jar file.");
916917
String jarName = exportName.substring(0, exportName.length() - 4) + ".jar";
917-
Base.copyFile(exportFile, new File(libsFolder, jarName));
918+
Util.copyFile(exportFile, new File(libsFolder, jarName));
918919

919920
} else if (exportName.toLowerCase().endsWith(".jar")) {
920-
Base.copyFile(exportFile, new File(libsFolder, exportName));
921+
Util.copyFile(exportFile, new File(libsFolder, exportName));
921922

922923
} else {
923-
Base.copyFile(exportFile, new File(assetsFolder, exportName));
924+
Util.copyFile(exportFile, new File(assetsFolder, exportName));
924925
}
925926
}
926927
}
@@ -983,7 +984,7 @@ private void copyCodeFolder(final File libsFolder) throws IOException {
983984
final String lcname = name.toLowerCase();
984985
if (lcname.endsWith(".jar") || lcname.endsWith(".zip")) {
985986
String jarName = name.substring(0, name.length() - 4) + ".jar";
986-
Base.copyFile(item, new File(libsFolder, jarName));
987+
Util.copyFile(item, new File(libsFolder, jarName));
987988
}
988989
}
989990
}

src/processing/mode/android/Commander.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import processing.app.RunnerListener;
3434
import processing.app.Sketch;
3535
import processing.app.SketchException;
36+
import processing.app.Util;
3637
import processing.app.contrib.ModeContribution;
3738

3839
/**
@@ -168,7 +169,7 @@ private void initValues() {
168169
outputFolder = new File(outputPath);
169170
if (outputFolder.exists()) {
170171
if (force) {
171-
Base.removeDir(outputFolder);
172+
Util.removeDir(outputFolder);
172173
} else {
173174
complainAndQuit("The output folder already exists. " + "Use --force to remove it.", false);
174175
}

0 commit comments

Comments
 (0)