Mistři v programování na #hovnokod

Java #91

// parse from the uninstall, the actuall installation path
		try {
			int jarLoc = uninstallDir.indexOf("-jar");
			String s = uninstallDir.substring(jarLoc + 5);
			// turn it into a normalized file
			int uniLoc = s.indexOf("uninstaller");
			s = s.substring(1,uniLoc);
			s = s.replace("\\", "/");
			if(s.endsWith("/"))
				s = s.substring(0,s.length()-1);

			File f = new File(s);
			if(!f.exists()) {
				throw new Exception("installation directory does not exist: " + s);
			}
			return f;
		}
		catch(Exception e) {
            throw new Exception("installation directory could not be parsed from: " + uninstallDir);		    
		}

Anonymous,