petite/src/wombat/scheme/Petite.java
private void findPetiteArchive() {
		try {
			for (File dir : searchDirs) {
				if (dir != null && dir.exists() && dir.isDirectory()) {
					for (String path : dir.list()) {
						if (path.startsWith("petite") && path.endsWith((OS.IsWindows ? "win" : OS.IsOSX ? "osx" : OS.IsLinux ? "linux" : "unknown") + ".zip")) {
							ZipFile zip = new ZipFile(new File(dir, path));
	
							@SuppressWarnings("unchecked")
							Enumeration<ZipEntry> entries = (Enumeration<ZipEntry>) zip.entries();
	
							while (entries.hasMoreElements()) {
								ZipEntry entry = entries.nextElement();
	
								if (entry.isDirectory()) {
									new File(dir, entry.getName()).getCanonicalFile().mkdirs();
								} else {
							    	new File(dir, entry.getName()).getCanonicalFile().getParentFile().mkdirs();
							    
									File targetFile = new File(dir, entry.getName());
									InputStream zipin = zip.getInputStream(entry);
									OutputStream zipout = new BufferedOutputStream(new FileOutputStream(targetFile));
												    
									byte[] buffer = new byte[1024];
									int len;
												    
									while((len = zipin.read(buffer)) >= 0)
										zipout.write(buffer, 0, len);
											    
									zipin.close();
									zipout.close();
									
									if (targetFile.getName().toLowerCase().startsWith("petite")) {
										targetFile.setExecutable(true);
								    }
							    }
							}
	
							zip.close();
							return;
						}
					}
				}
			}
		} catch(IOException ex) {
			System.err.println("Unable to open petite archive: " + ex.getMessage());
		}
	}
/**
	 * Find and unzip the proper Petite archive if it hasn't already been.
	 */
Find and unzip the proper Petite archive if it hasn't already been.
Find and unzip the proper Petite archive if it hasn ' t already been .
private void findPetiteArchive() {
		try {
			for (File dir : searchDirs) {
				if (dir != null && dir.exists() && dir.isDirectory()) {
					for (String path : dir.list()) {
						if (path.startsWith("petite") && path.endsWith((OS.IsWindows ? "win" : OS.IsOSX ? "osx" : OS.IsLinux ? "linux" : "unknown") + ".zip")) {
							ZipFile zip = new ZipFile(new File(dir, path));
							@SuppressWarnings("unchecked")
							Enumeration<ZipEntry> entries = (Enumeration<ZipEntry>) zip.entries();
							while (entries.hasMoreElements()) {
								ZipEntry entry = entries.nextElement();
								if (entry.isDirectory()) {
									new File(dir, entry.getName()).getCanonicalFile().mkdirs();
								} else {
							    	new File(dir, entry.getName()).getCanonicalFile().getParentFile().mkdirs();
									File targetFile = new File(dir, entry.getName());
									InputStream zipin = zip.getInputStream(entry);
									OutputStream zipout = new BufferedOutputStream(new FileOutputStream(targetFile));
									byte[] buffer = new byte[1024];
									int len;
									while((len = zipin.read(buffer)) >= 0)
										zipout.write(buffer, 0, len);
									zipin.close();
									zipout.close();
									if (targetFile.getName().toLowerCase().startsWith("petite")) {
										targetFile.setExecutable(true);
								    }
							    }
							}
							zip.close();
							return;
						}
					}
				}
			}
		} catch(IOException ex) {
			System.err.println("Unable to open petite archive: " + ex.getMessage());
		}
	}
private void findPetiteArchive ( ) { try { for ( File dir : searchDirs ) { if ( dir != null && dir . exists ( ) && dir . isDirectory ( ) ) { for ( String path : dir . list ( ) ) { if ( path . startsWith ( "petite" ) && path . endsWith ( ( OS . IsWindows ? "win" : OS . IsOSX ? "osx" : OS . IsLinux ? "linux" : "unknown" ) + ".zip" ) ) { ZipFile zip = new ZipFile ( new File ( dir , path ) ) ; @ SuppressWarnings ( "unchecked" ) Enumeration < ZipEntry > entries = ( Enumeration < ZipEntry > ) zip . entries ( ) ; while ( entries . hasMoreElements ( ) ) { ZipEntry entry = entries . nextElement ( ) ; if ( entry . isDirectory ( ) ) { new File ( dir , entry . getName ( ) ) . getCanonicalFile ( ) . mkdirs ( ) ; } else { new File ( dir , entry . getName ( ) ) . getCanonicalFile ( ) . getParentFile ( ) . mkdirs ( ) ; File targetFile = new File ( dir , entry . getName ( ) ) ; InputStream zipin = zip . getInputStream ( entry ) ; OutputStream zipout = new BufferedOutputStream ( new FileOutputStream ( targetFile ) ) ; byte [ ] buffer = new byte [ 1024 ] ; int len ; while ( ( len = zipin . read ( buffer ) ) >= 0 ) zipout . write ( buffer , 0 , len ) ; zipin . close ( ) ; zipout . close ( ) ; if ( targetFile . getName ( ) . toLowerCase ( ) . startsWith ( "petite" ) ) { targetFile . setExecutable ( true ) ; } } } zip . close ( ) ; return ; } } } } } catch ( IOException ex ) { System . err . println ( "Unable to open petite archive: " + ex . getMessage ( ) ) ; } }
Find and unzip the proper Petite archive if it hasn't already been.
Find and unzip the proper Petite archive if it hasn ' t already been .