public static File getLauncherDir()
    {
        File dir = null;
        
        File root = new File(System.getProperty("user.home", ".") + "/");
        final String appName = "mclauncher";
        
        switch (SystemUtils.getSystemOS())
        {
            case linux:
            case solaris:
                dir = new File(root, "." + appName + "/");
                break;
            
            case macosx:
                dir = new File(root, "Library/Application Support/" + appName);
                break;
            
            case windows:
                final String applicationData = System.getenv("APPDATA");
                if (applicationData != null)
                {
                    root = new File(applicationData);
                }
                
                dir = new File(root, '.' + appName + '/');
                break;
            
            default:
                dir = new File(root, appName + '/');
                break;
        }
        
        if (dir != null && !dir.exists() && !dir.mkdirs())
        {
            throw new RuntimeException(
                    "The working directory could not be created: " + dir);
        }
        
        return dir;
    }