Last active
November 7, 2017 16:58
-
-
Save n1ckfg/6234436 to your computer and use it in GitHub Desktop.
Open the app's folder in Processing, cross-platform
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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