Created
April 20, 2012 09:28
-
-
Save Cakemix1337/2427327 to your computer and use it in GitHub Desktop.
%appdata% finder
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
private File appFileFinder(String folder, String file) { | |
String OS = System.getProperty("os.name").toUpperCase(); | |
if (OS.contains("WIN")) { | |
if (new File(System.getenv("APPDATA")).exists()) { | |
if (!new File(System.getenv("APPDATA") + "/"+folder).exists()) { | |
new File(System.getenv("APPDATA") + "/"+folder).mkdirs(); | |
} | |
return new File(System.getenv("APPDATA") + "/"+folder+"/" ); | |
} | |
return new File(file); | |
} else if (OS.contains("MAC")) { | |
if (new File(System.getProperty("user.home") + "/Library/Application Support").exists()) { | |
if (!new File(new File(System.getProperty("user.home") + "/Library/Application Support") + "/"+folder).exists()) { | |
new File(new File(System.getProperty("user.home") + "/Library/Application Support") + "/"+folder).mkdirs(); | |
} | |
return new File(new File(System.getProperty("user.home") + "/Library/Application Support") +"/"+folder+"/" ); | |
} | |
return new File(file); | |
} | |
return new File(file); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment