public static File getAppDir(String dirname) {
		String s = System.getProperty("user.home", ".");
		File file;

		switch (getOs()) {
			case linux:
			case solaris:
				file = new File(s, "." + dirname + '/');
				break;

			case windows:
				String s1 = System.getenv("APPDATA");

				if (s1 != null) {
					file = new File(s1, "." + dirname + '/');
				} else {
					file = new File(s, "." + dirname + '/');
				}

				break;

			case macos:
				file = new File(s, "Library/Application Support/" + dirname);
				break;

			default:
				file = new File(s, dirname + "/");
				break;
		}

		if (!file.exists() && !file.mkdirs()) {
			throw new RuntimeException((new StringBuilder()).append("The working directory could not be created: ").append(file).toString());
		} else {
			return file;
		}
	}