Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * To switch and find the current Operating system.
- *
- */
- public enum OS {
- WINDOWS, MAC, LINUX, OTHER
- }
- /**
- * Returns the location of the AppData directory
- *
- * @return String representation of the AppData directory
- */
- public static String getAppData() {
- return getOS() == OS.WINDOWS ? System.getenv("APPDATA") : System.getProperty("user.home");
- }
- /**
- * Returns the OS system for basic configuration
- *
- * @return Returns an enumerator for the OS.
- */
- private static OS getOS() {
- String os = System.getProperty("os.name").toLowerCase();
- if (os.contains("windows")) {
- return OS.WINDOWS;
- }
- if (os.contains("mac")) {
- return OS.MAC;
- }
- if (os.contains("linux")) {
- return OS.LINUX;
- }
- return OS.OTHER;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement