Skip to content

Instantly share code, notes, and snippets.

@n1ckfg
Last active November 7, 2017 16:58
Show Gist options
  • Save n1ckfg/6234436 to your computer and use it in GitHub Desktop.
Save n1ckfg/6234436 to your computer and use it in GitHub Desktop.
Open the app's folder in Processing, cross-platform
import java.awt.Desktop;
void setup(){
openAppFolderHandler();
}
void openAppFolderHandler(){
String os = "Mac OS X";
try{
os = System.getProperty("os.name");
println("OS appears to be " + os + ".");
}catch(Exception e){
println("Couldn't determine OS.");
}
if(os.charAt(0)==char('W')&&os.charAt(1)==char('i')&&os.charAt(2)==char('n')){
try{
print("Trying Windows method.");
Desktop.getDesktop().open(new File(sketchPath("")));
}catch(Exception e){ }
}else{
try{
print("Trying OS X/Linux method.");
open(sketchPath(""));
}catch(Exception e){ }
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment