mirror of
https://github.com/arduino/Arduino.git
synced 2024-11-29 10:24:12 +01:00
Moved getBuildFolder() and related members/methods from Base to BaseNoGui.
This commit is contained in:
parent
6d28e12a41
commit
4d3599b2c4
@ -27,7 +27,6 @@ import java.awt.event.*;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
@ -74,8 +73,6 @@ public class Base {
|
||||
// so that the errors while building don't show up again.
|
||||
boolean builtOnce;
|
||||
|
||||
static File buildFolder;
|
||||
|
||||
// classpath for all known libraries for p5
|
||||
// (both those in the p5/libs folder and those with lib subfolders
|
||||
// found in the sketchbook)
|
||||
@ -1610,20 +1607,7 @@ public class Base {
|
||||
|
||||
|
||||
static public File getBuildFolder() {
|
||||
if (buildFolder == null) {
|
||||
String buildPath = Preferences.get("build.path");
|
||||
if (buildPath != null) {
|
||||
buildFolder = absoluteFile(buildPath);
|
||||
if (!buildFolder.exists())
|
||||
buildFolder.mkdirs();
|
||||
} else {
|
||||
//File folder = new File(getTempFolder(), "build");
|
||||
//if (!folder.exists()) folder.mkdirs();
|
||||
buildFolder = createTempFolder("build");
|
||||
buildFolder.deleteOnExit();
|
||||
}
|
||||
}
|
||||
return buildFolder;
|
||||
return BaseNoGui.getBuildFolder();
|
||||
}
|
||||
|
||||
|
||||
@ -1635,18 +1619,7 @@ public class Base {
|
||||
* to avoid conflicts in multi-user environments. (Bug 177)
|
||||
*/
|
||||
static public File createTempFolder(String name) {
|
||||
try {
|
||||
File folder = File.createTempFile(name, null);
|
||||
//String tempPath = ignored.getParent();
|
||||
//return new File(tempPath);
|
||||
folder.delete();
|
||||
folder.mkdirs();
|
||||
return folder;
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
return BaseNoGui.createTempFolder(name);
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,6 +43,8 @@ public class BaseNoGui {
|
||||
/** Set true if this a proper release rather than a numbered revision. */
|
||||
static public boolean RELEASE = false;
|
||||
|
||||
static File buildFolder;
|
||||
|
||||
// Current directory to use for relative paths specified on the
|
||||
// commandline
|
||||
static String currentDirectory = System.getProperty("user.dir");
|
||||
@ -97,6 +99,28 @@ public class BaseNoGui {
|
||||
return count;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the path to the platform's temporary folder, by creating
|
||||
* a temporary temporary file and getting its parent folder.
|
||||
* <br/>
|
||||
* Modified for revision 0094 to actually make the folder randomized
|
||||
* to avoid conflicts in multi-user environments. (Bug 177)
|
||||
*/
|
||||
static public File createTempFolder(String name) {
|
||||
try {
|
||||
File folder = File.createTempFile(name, null);
|
||||
//String tempPath = ignored.getParent();
|
||||
//return new File(tempPath);
|
||||
folder.delete();
|
||||
folder.mkdirs();
|
||||
return folder;
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static public String getAvrBasePath() {
|
||||
String path = getHardwarePath() + File.separator + "tools" +
|
||||
File.separator + "avr" + File.separator + "bin" + File.separator;
|
||||
@ -106,6 +130,23 @@ public class BaseNoGui {
|
||||
return path;
|
||||
}
|
||||
|
||||
static public File getBuildFolder() {
|
||||
if (buildFolder == null) {
|
||||
String buildPath = Preferences.get("build.path");
|
||||
if (buildPath != null) {
|
||||
buildFolder = absoluteFile(buildPath);
|
||||
if (!buildFolder.exists())
|
||||
buildFolder.mkdirs();
|
||||
} else {
|
||||
//File folder = new File(getTempFolder(), "build");
|
||||
//if (!folder.exists()) folder.mkdirs();
|
||||
buildFolder = createTempFolder("build");
|
||||
buildFolder.deleteOnExit();
|
||||
}
|
||||
}
|
||||
return buildFolder;
|
||||
}
|
||||
|
||||
static public PreferencesMap getBoardPreferences() {
|
||||
TargetBoard board = getTargetBoard();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user