public class Platform
extends Object
Constructor and Description |
---|
Platform() |
Modifier and Type | Method and Description |
---|---|
static boolean |
deleteFile(File file)
Attempts to move to the Trash on OS X, or the Recycle Bin on Windows.
|
static File |
getContentFile(String name)
Get reference to a file adjacent to the executable on Windows and Linux,
or inside Contents/Resources/Java on Mac OS X.
|
static File |
getDefaultSketchbookFolder() |
static String |
getenv(String variable) |
static int |
getIndex(String what) |
static File |
getJavaHome() |
static String |
getJavaPath()
Get the path to the embedded Java executable.
|
static String |
getName() |
static String |
getName(int which)
Map a platform constant to its name.
|
static String |
getNativeArch()
Return the value of the os.arch property
|
static int |
getNativeBits()
Return whether sketches will run as 32- or 64-bits based
on the JVM that's in use.
|
static File |
getSettingsFolder() |
static int |
getSystemDPI() |
static String |
getVariant() |
static String |
getVariant(int platform,
String arch,
int bits) |
static void |
init() |
static void |
initBase(Base base) |
static boolean |
isLinux()
true if running on linux.
|
static boolean |
isMacOS()
returns true if Processing is running on a Mac OS X machine.
|
static boolean |
isWindows()
returns true if running on windows.
|
static void |
openFolder(File file)
Implements the other cross-platform headache of opening
a folder in the machine's native file browser.
|
static boolean |
openFolderAvailable()
Used to determine whether to disable the "Show Sketch Folder" option.
|
static void |
openURL(String url)
Implements the cross-platform headache of opening URLs.
|
static void |
saveLanguage(String languageCode) |
static void |
setenv(String variable,
String value) |
static void |
setLookAndFeel() |
static int |
unsetenv(String variable) |
public static void init()
public static void initBase(Base base) throws Exception
Exception
public static void setLookAndFeel() throws Exception
Exception
public static File getSettingsFolder() throws Exception
Exception
public static File getDefaultSketchbookFolder() throws Exception
Exception
public static void saveLanguage(String languageCode)
public static void openURL(String url)
public static boolean openFolderAvailable()
public static void openFolder(File file)
public static int getNativeBits()
public static String getNativeArch()
public static String getVariant()
public static String getVariant(int platform, String arch, int bits)
public static String getName()
public static String getName(int which)
which
- PConstants.WINDOWS, PConstants.MACOSX, PConstants.LINUXpublic static int getIndex(String what)
public static boolean isMacOS()
public static boolean isWindows()
public static boolean isLinux()
public static File getContentFile(String name)
public static File getJavaHome()
public static String getJavaPath()
public static boolean deleteFile(File file) throws IOException
file
- the folder or file to be removed/deletedIOException
public static void setenv(String variable, String value)
public static String getenv(String variable)
public static int unsetenv(String variable)
public static int getSystemDPI()