List of usage examples for java.io File equals
public boolean equals(Object obj)
From source file:org.openmrs.util.OpenmrsClassLoader.java
/** * Deletes the old lib cache folders that might not have been deleted when OpenMRS closed * // w ww .j a v a 2s . c om * @param libCacheFolder */ public static void deleteOldLibCaches(File libCacheFolder) { FilenameFilter cacheDirFilter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return name.endsWith(LIBCACHESUFFIX); } }; FilenameFilter lockFilter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { return "lock".equals(name); } }; File tempLocation = libCacheFolder.getParentFile(); File[] listFiles = tempLocation.listFiles(cacheDirFilter); if (listFiles != null) { for (File cacheDir : listFiles) { //check if it is a directory, but is not the current lib cache if (cacheDir.isDirectory() && !cacheDir.equals(libCacheFolder) && cacheDir.list(lockFilter).length == 0) { // check if its not locked by another running openmrs instance try { OpenmrsUtil.deleteDirectory(cacheDir); } catch (IOException io) { log.warn("Unable to delete: " + cacheDir.getName()); } } } } }
From source file:com.jug.MoMA.java
/** * PROJECT MAIN/*from ww w. j a v a 2 s . c om*/ * * @param args */ public static void main(final String[] args) { if (showIJ) new ImageJ(); // // ===== set look and feel ======================================================================== // try { // // Set cross-platform Java L&F (also called "Metal") // UIManager.setLookAndFeel( // UIManager.getCrossPlatformLookAndFeelClassName() ); // } catch ( final UnsupportedLookAndFeelException e ) { // // handle exception // } catch ( final ClassNotFoundException e ) { // // handle exception // } catch ( final InstantiationException e ) { // // handle exception // } catch ( final IllegalAccessException e ) { // // handle exception // } // ===== command line parsing ====================================================================== // create Options object & the parser final Options options = new Options(); final CommandLineParser parser = new BasicParser(); // defining command line options final Option help = new Option("help", "print this message"); final Option headless = new Option("h", "headless", false, "start without user interface (note: input-folder must be given!)"); headless.setRequired(false); final Option timeFirst = new Option("tmin", "min_time", true, "first time-point to be processed"); timeFirst.setRequired(false); final Option timeLast = new Option("tmax", "max_time", true, "last time-point to be processed"); timeLast.setRequired(false); final Option optRange = new Option("orange", "opt_range", true, "initial optimization range"); optRange.setRequired(false); final Option numChannelsOption = new Option("c", "channels", true, "number of channels to be loaded and analyzed."); numChannelsOption.setRequired(true); final Option minChannelIdxOption = new Option("cmin", "min_channel", true, "the smallest channel index (usually 0 or 1, default is 1)."); minChannelIdxOption.setRequired(false); final Option infolder = new Option("i", "infolder", true, "folder to read data from"); infolder.setRequired(false); final Option outfolder = new Option("o", "outfolder", true, "folder to write preprocessed data to (equals infolder if not given)"); outfolder.setRequired(false); final Option userProps = new Option("p", "props", true, "properties file to be loaded (mm.properties)"); userProps.setRequired(false); options.addOption(help); options.addOption(headless); options.addOption(numChannelsOption); options.addOption(minChannelIdxOption); options.addOption(timeFirst); options.addOption(timeLast); options.addOption(optRange); options.addOption(infolder); options.addOption(outfolder); options.addOption(userProps); // get the commands parsed CommandLine cmd = null; try { cmd = parser.parse(options, args); } catch (final ParseException e1) { final HelpFormatter formatter = new HelpFormatter(); formatter.printHelp( "... [-p props-file] -i in-folder [-o out-folder] -c <num-channels> [-cmin start-channel-ids] [-tmin idx] [-tmax idx] [-orange num-frames] [-headless]", "", options, "Error: " + e1.getMessage()); System.exit(0); } if (cmd.hasOption("help")) { final HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("... -i <in-folder> -o [out-folder] [-headless]", options); System.exit(0); } if (cmd.hasOption("h")) { System.out.println(">>> Starting MM in headless mode."); HEADLESS = true; if (!cmd.hasOption("i")) { final HelpFormatter formatter = new HelpFormatter(); formatter.printHelp("Headless-mode requires option '-i <in-folder>'...", options); System.exit(0); } } File inputFolder = null; if (cmd.hasOption("i")) { inputFolder = new File(cmd.getOptionValue("i")); if (!inputFolder.isDirectory()) { System.out.println("Error: Input folder is not a directory!"); System.exit(2); } if (!inputFolder.canRead()) { System.out.println("Error: Input folder cannot be read!"); System.exit(2); } } File outputFolder = null; if (!cmd.hasOption("o")) { if (inputFolder == null) { System.out.println( "Error: Output folder would be set to a 'null' input folder! Please check your command line arguments..."); System.exit(3); } outputFolder = inputFolder; STATS_OUTPUT_PATH = outputFolder.getAbsolutePath(); } else { outputFolder = new File(cmd.getOptionValue("o")); if (!outputFolder.isDirectory()) { System.out.println("Error: Output folder is not a directory!"); System.exit(3); } if (!inputFolder.canWrite()) { System.out.println("Error: Output folder cannot be written to!"); System.exit(3); } STATS_OUTPUT_PATH = outputFolder.getAbsolutePath(); } fileUserProps = null; if (cmd.hasOption("p")) { fileUserProps = new File(cmd.getOptionValue("p")); } if (cmd.hasOption("cmin")) { minChannelIdx = Integer.parseInt(cmd.getOptionValue("cmin")); } if (cmd.hasOption("c")) { numChannels = Integer.parseInt(cmd.getOptionValue("c")); } if (cmd.hasOption("tmin")) { minTime = Integer.parseInt(cmd.getOptionValue("tmin")); } if (cmd.hasOption("tmax")) { maxTime = Integer.parseInt(cmd.getOptionValue("tmax")); } if (cmd.hasOption("orange")) { initOptRange = Integer.parseInt(cmd.getOptionValue("orange")); } // ******** CHECK GUROBI ********* CHECK GUROBI ********* CHECK GUROBI ********* final String jlp = System.getProperty("java.library.path"); // System.out.println( jlp ); try { new GRBEnv("MoMA_gurobi.log"); } catch (final GRBException e) { final String msgs = "Initial Gurobi test threw exception... check your Gruobi setup!\n\nJava library path: " + jlp; if (HEADLESS) { System.out.println(msgs); } else { JOptionPane.showMessageDialog(MoMA.guiFrame, msgs, "Gurobi Error?", JOptionPane.ERROR_MESSAGE); } e.printStackTrace(); System.exit(98); } catch (final UnsatisfiedLinkError ulr) { final String msgs = "Could initialize Gurobi.\n" + "You might not have installed Gurobi properly or you miss a valid license.\n" + "Please visit 'www.gurobi.com' for further information.\n\n" + ulr.getMessage() + "\nJava library path: " + jlp; if (HEADLESS) { System.out.println(msgs); } else { JOptionPane.showMessageDialog(MoMA.guiFrame, msgs, "Gurobi Error?", JOptionPane.ERROR_MESSAGE); ulr.printStackTrace(); } System.out.println("\n>>>>> Java library path: " + jlp + "\n"); System.exit(99); } // ******* END CHECK GUROBI **** END CHECK GUROBI **** END CHECK GUROBI ******** final MoMA main = new MoMA(); if (!HEADLESS) { guiFrame = new JFrame(); main.initMainWindow(guiFrame); } System.out.println("VERSION: " + VERSION_STRING); props = main.loadParams(); BGREM_TEMPLATE_XMIN = Integer .parseInt(props.getProperty("BGREM_TEMPLATE_XMIN", Integer.toString(BGREM_TEMPLATE_XMIN))); BGREM_TEMPLATE_XMAX = Integer .parseInt(props.getProperty("BGREM_TEMPLATE_XMAX", Integer.toString(BGREM_TEMPLATE_XMAX))); BGREM_X_OFFSET = Integer.parseInt(props.getProperty("BGREM_X_OFFSET", Integer.toString(BGREM_X_OFFSET))); GL_WIDTH_IN_PIXELS = Integer .parseInt(props.getProperty("GL_WIDTH_IN_PIXELS", Integer.toString(GL_WIDTH_IN_PIXELS))); MOTHER_CELL_BOTTOM_TRICK_MAX_PIXELS = Integer.parseInt(props.getProperty( "MOTHER_CELL_BOTTOM_TRICK_MAX_PIXELS", Integer.toString(MOTHER_CELL_BOTTOM_TRICK_MAX_PIXELS))); GL_FLUORESCENCE_COLLECTION_WIDTH_IN_PIXELS = Integer .parseInt(props.getProperty("GL_FLUORESCENCE_COLLECTION_WIDTH_IN_PIXELS", Integer.toString(GL_FLUORESCENCE_COLLECTION_WIDTH_IN_PIXELS))); GL_OFFSET_BOTTOM = Integer .parseInt(props.getProperty("GL_OFFSET_BOTTOM", Integer.toString(GL_OFFSET_BOTTOM))); if (GL_OFFSET_BOTTOM == -1) { GL_OFFSET_BOTTOM_AUTODETECT = true; } else { GL_OFFSET_BOTTOM_AUTODETECT = false; } GL_OFFSET_TOP = Integer.parseInt(props.getProperty("GL_OFFSET_TOP", Integer.toString(GL_OFFSET_TOP))); GL_OFFSET_LATERAL = Integer .parseInt(props.getProperty("GL_OFFSET_LATERAL", Integer.toString(GL_OFFSET_LATERAL))); MIN_CELL_LENGTH = Integer.parseInt(props.getProperty("MIN_CELL_LENGTH", Integer.toString(MIN_CELL_LENGTH))); MIN_GAP_CONTRAST = Float .parseFloat(props.getProperty("MIN_GAP_CONTRAST", Float.toString(MIN_GAP_CONTRAST))); SIGMA_PRE_SEGMENTATION_X = Float.parseFloat( props.getProperty("SIGMA_PRE_SEGMENTATION_X", Float.toString(SIGMA_PRE_SEGMENTATION_X))); SIGMA_PRE_SEGMENTATION_Y = Float.parseFloat( props.getProperty("SIGMA_PRE_SEGMENTATION_Y", Float.toString(SIGMA_PRE_SEGMENTATION_Y))); SIGMA_GL_DETECTION_X = Float .parseFloat(props.getProperty("SIGMA_GL_DETECTION_X", Float.toString(SIGMA_GL_DETECTION_X))); SIGMA_GL_DETECTION_Y = Float .parseFloat(props.getProperty("SIGMA_GL_DETECTION_Y", Float.toString(SIGMA_GL_DETECTION_Y))); SEGMENTATION_MIX_CT_INTO_PMFRF = Float.parseFloat(props.getProperty("SEGMENTATION_MIX_CT_INTO_PMFRF", Float.toString(SEGMENTATION_MIX_CT_INTO_PMFRF))); SEGMENTATION_CLASSIFIER_MODEL_FILE = props.getProperty("SEGMENTATION_CLASSIFIER_MODEL_FILE", SEGMENTATION_CLASSIFIER_MODEL_FILE); CELLSIZE_CLASSIFIER_MODEL_FILE = props.getProperty("CELLSIZE_CLASSIFIER_MODEL_FILE", CELLSIZE_CLASSIFIER_MODEL_FILE); DEFAULT_PATH = props.getProperty("DEFAULT_PATH", DEFAULT_PATH); GUROBI_TIME_LIMIT = Double .parseDouble(props.getProperty("GUROBI_TIME_LIMIT", Double.toString(GUROBI_TIME_LIMIT))); GUROBI_MAX_OPTIMALITY_GAP = Double.parseDouble( props.getProperty("GUROBI_MAX_OPTIMALITY_GAP", Double.toString(GUROBI_MAX_OPTIMALITY_GAP))); GUI_POS_X = Integer.parseInt(props.getProperty("GUI_POS_X", Integer.toString(DEFAULT_GUI_POS_X))); GUI_POS_Y = Integer.parseInt(props.getProperty("GUI_POS_Y", Integer.toString(DEFAULT_GUI_POS_X))); GUI_WIDTH = Integer.parseInt(props.getProperty("GUI_WIDTH", Integer.toString(GUI_WIDTH))); GUI_HEIGHT = Integer.parseInt(props.getProperty("GUI_HEIGHT", Integer.toString(GUI_HEIGHT))); GUI_CONSOLE_WIDTH = Integer .parseInt(props.getProperty("GUI_CONSOLE_WIDTH", Integer.toString(GUI_CONSOLE_WIDTH))); if (!HEADLESS) { // Iterate over all currently attached monitors and check if sceen // position is actually possible, // otherwise fall back to the DEFAULT values and ignore the ones // coming from the properties-file. boolean pos_ok = false; final GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment(); final GraphicsDevice[] gs = ge.getScreenDevices(); for (int i = 0; i < gs.length; i++) { if (gs[i].getDefaultConfiguration().getBounds() .contains(new java.awt.Point(GUI_POS_X, GUI_POS_Y))) { pos_ok = true; } } // None of the screens contained the top-left window coordinates --> // fall back onto default values... if (!pos_ok) { GUI_POS_X = DEFAULT_GUI_POS_X; GUI_POS_Y = DEFAULT_GUI_POS_Y; } } String path = props.getProperty("import_path", System.getProperty("user.home")); if (inputFolder == null || inputFolder.equals("")) { inputFolder = main.showStartupDialog(guiFrame, path); } System.out.println("Default filename decoration = " + inputFolder.getName()); defaultFilenameDecoration = inputFolder.getName(); path = inputFolder.getAbsolutePath(); props.setProperty("import_path", path); GrowthLineSegmentationMagic.setClassifier(SEGMENTATION_CLASSIFIER_MODEL_FILE, ""); if (!HEADLESS) { // Setting up console window... main.initConsoleWindow(); main.showConsoleWindow(true); } // ------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------ final MoMAModel mmm = new MoMAModel(main); instance = main; try { main.processDataFromFolder(path, minTime, maxTime, minChannelIdx, numChannels); } catch (final Exception e) { e.printStackTrace(); System.exit(11); } // ------------------------------------------------------------------------------------------------------ // ------------------------------------------------------------------------------------------------------ // show loaded and annotated data if (showIJ) { new ImageJ(); ImageJFunctions.show(main.imgRaw, "Rotated & cropped raw data"); // ImageJFunctions.show( main.imgTemp, "Temporary" ); // ImageJFunctions.show( main.imgAnnotated, "Annotated ARGB data" ); // main.getCellSegmentedChannelImgs() // ImageJFunctions.show( main.imgClassified, "Classification" ); // ImageJFunctions.show( main.getCellSegmentedChannelImgs(), "Segmentation" ); } gui = new MoMAGui(mmm); if (!HEADLESS) { System.out.print("Build GUI..."); main.showConsoleWindow(false); // final JFrameSnapper snapper = new JFrameSnapper(); // snapper.addFrame( main.frameConsoleWindow ); // snapper.addFrame( guiFrame ); gui.setVisible(true); guiFrame.add(gui); guiFrame.setSize(GUI_WIDTH, GUI_HEIGHT); guiFrame.setLocation(GUI_POS_X, GUI_POS_Y); guiFrame.setVisible(true); // SwingUtilities.invokeLater( new Runnable() { // // @Override // public void run() { // snapper.snapFrames( main.frameConsoleWindow, guiFrame, JFrameSnapper.EAST ); // } // } ); System.out.println(" done!"); } else { // final String name = inputFolder.getName(); gui.exportHtmlOverview(); gui.exportDataFiles(); instance.saveParams(); System.exit(0); } }
From source file:org.jfrog.build.extractor.clientConfiguration.util.PublishedItemsHelper.java
/** * Gets the relative path of a given file to the base * * @param base the base path to calculate the relative path * @param file the file itself/* w ww . j a v a2 s . c o m*/ * @return the calculated relative path */ private static String getRelativePath(File base, File file) { if (base == null || file == null) { return null; } if (!base.isDirectory()) { base = base.getParentFile(); if (base == null) { return null; } } if (base.equals(file)) { return "."; } else { String filePath = file.getAbsolutePath(); String basePath = base.getAbsolutePath(); return getRelativePath(basePath, filePath, File.separatorChar); } }
From source file:org.gradle.cache.internal.AbstractCacheCleanup.java
protected int deleteEmptyParentDirectories(File baseDir, File dir) { if (dir.equals(baseDir)) { return 0; }// ww w.jav a2 s . c om File[] files = dir.listFiles(); if (files != null && files.length == 0 && dir.delete()) { handleDeletion(dir); return 1 + deleteEmptyParentDirectories(baseDir, dir.getParentFile()); } return 0; }
From source file:com.filemanager.free.filesystem.FileUtil.java
/** * Get a list of external SD card paths. (Kitkat or higher.) * * @return A list of external SD card paths. *///from w ww .j a va2s .com @TargetApi(Build.VERSION_CODES.KITKAT) public static String[] getExtSdCardPaths(Context context) { List<String> paths = new ArrayList<String>(); for (File file : context.getExternalFilesDirs("external")) { if (file != null && !file.equals(context.getExternalFilesDir("external"))) { int index = file.getAbsolutePath().lastIndexOf("/Android/data"); if (index < 0) { Log.w("FileUtils", "Unexpected external file dir: " + file.getAbsolutePath()); } else { String path = file.getAbsolutePath().substring(0, index); try { path = new File(path).getCanonicalPath(); } catch (IOException e) { // Keep non-canonical path. } paths.add(path); } } } if (paths.isEmpty()) paths.add("/storage/sdcard1"); return paths.toArray(new String[0]); }
From source file:com.roche.sequencing.bioinformatics.common.utils.FileUtil.java
public static boolean isDirectoryParentOfFile(File directory, File file) { boolean directoryIsParent = false; File ancestorOfFile = file.getParentFile(); while (ancestorOfFile != null && !directoryIsParent) { directoryIsParent = ancestorOfFile.equals(directory); ancestorOfFile = ancestorOfFile.getParentFile(); }/*from w ww . ja v a 2s . c o m*/ return directoryIsParent; }
From source file:com.bittorrent.mpetazzoni.common.Torrent.java
/** * Helper method to create a {@link Torrent} object for a set of files. * * <p>/*from w ww . j a va2 s. c om*/ * Hash the given files to create the multi-file {@link Torrent} object * representing the Torrent meta-info about them, needed for announcing * and/or sharing these files. Since we created the torrent, we're * considering we'll be a full initial seeder for it. * </p> * * @param parent The parent directory or location of the torrent files, * also used as the torrent's name. * @param files The files to add into this torrent. * @param announce The announce URI that will be used for this torrent. * @param announceList The announce URIs organized as tiers that will * be used for this torrent * @param createdBy The creator's name, or any string identifying the * torrent's creator. */ private static Torrent create(File parent, List<File> files, URI announce, List<List<URI>> announceList, String createdBy) throws InterruptedException, IOException { if (files == null || files.isEmpty()) { logger.info("Creating single-file torrent for {}...", parent.getName()); } else { logger.info("Creating {}-file torrent {}...", files.size(), parent.getName()); } Map<String, BEValue> torrent = new HashMap<String, BEValue>(); if (announce != null) { torrent.put("announce", new BEValue(announce.toString())); } if (announceList != null) { List<BEValue> tiers = new LinkedList<BEValue>(); for (List<URI> trackers : announceList) { List<BEValue> tierInfo = new LinkedList<BEValue>(); for (URI trackerURI : trackers) { tierInfo.add(new BEValue(trackerURI.toString())); } tiers.add(new BEValue(tierInfo)); } torrent.put("announce-list", new BEValue(tiers)); } torrent.put("creation date", new BEValue(new Date().getTime() / 1000)); torrent.put("created by", new BEValue(createdBy)); Map<String, BEValue> info = new TreeMap<String, BEValue>(); info.put("name", new BEValue(parent.getName())); info.put("piece length", new BEValue(Torrent.PIECE_LENGTH)); if (files == null || files.isEmpty()) { info.put("length", new BEValue(parent.length())); info.put("pieces", new BEValue(Torrent.hashFile(parent), Torrent.BYTE_ENCODING)); } else { List<BEValue> fileInfo = new LinkedList<BEValue>(); for (File file : files) { Map<String, BEValue> fileMap = new HashMap<String, BEValue>(); fileMap.put("length", new BEValue(file.length())); LinkedList<BEValue> filePath = new LinkedList<BEValue>(); while (file != null) { if (file.equals(parent)) { break; } filePath.addFirst(new BEValue(file.getName())); file = file.getParentFile(); } fileMap.put("path", new BEValue(filePath)); fileInfo.add(new BEValue(fileMap)); } info.put("files", new BEValue(fileInfo)); info.put("pieces", new BEValue(Torrent.hashFiles(files), Torrent.BYTE_ENCODING)); } torrent.put("info", new BEValue(info)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BEncoder.bencode(new BEValue(torrent), baos); return new Torrent(baos.toByteArray(), true); }
From source file:com.turn.ttorrent.common.Torrent.java
/** * Helper method to create a {@link Torrent} object for a set of files. * * <p>/*from ww w. j a v a 2s .co m*/ * Hash the given files to create the multi-file {@link Torrent} object * representing the Torrent meta-info about them, needed for announcing * and/or sharing these files. Since we created the torrent, we're * considering we'll be a full initial seeder for it. * </p> * * @param parent The parent directory or location of the torrent files, * also used as the torrent's name. * @param files The files to add into this torrent. * @param announce The announce URI that will be used for this torrent. * @param announceList The announce URIs organized as tiers that will * be used for this torrent * @param createdBy The creator's name, or any string identifying the * torrent's creator. */ private static Torrent create(File parent, List<File> files, int pieceLength, URI announce, List<List<URI>> announceList, String createdBy) throws InterruptedException, IOException, NoSuchAlgorithmException { if (files == null || files.isEmpty()) { logger.info("Creating single-file torrent for {}...", parent.getName()); } else { logger.info("Creating {}-file torrent {}...", files.size(), parent.getName()); } Map<String, BEValue> torrent = new HashMap<String, BEValue>(); if (announce != null) { torrent.put("announce", new BEValue(announce.toString())); } if (announceList != null) { List<BEValue> tiers = new LinkedList<BEValue>(); for (List<URI> trackers : announceList) { List<BEValue> tierInfo = new LinkedList<BEValue>(); for (URI trackerURI : trackers) { tierInfo.add(new BEValue(trackerURI.toString())); } tiers.add(new BEValue(tierInfo)); } torrent.put("announce-list", new BEValue(tiers)); } torrent.put("creation date", new BEValue(new Date().getTime() / 1000)); torrent.put("created by", new BEValue(createdBy)); Map<String, BEValue> info = new TreeMap<String, BEValue>(); info.put("name", new BEValue(parent.getName())); info.put("piece length", new BEValue(pieceLength)); if (files == null || files.isEmpty()) { info.put("length", new BEValue(parent.length())); info.put("pieces", new BEValue(Torrent.hashFile(parent, pieceLength), Torrent.BYTE_ENCODING)); } else { List<BEValue> fileInfo = new LinkedList<BEValue>(); for (File file : files) { Map<String, BEValue> fileMap = new HashMap<String, BEValue>(); fileMap.put("length", new BEValue(file.length())); LinkedList<BEValue> filePath = new LinkedList<BEValue>(); while (file != null) { if (file.equals(parent)) { break; } filePath.addFirst(new BEValue(file.getName())); file = file.getParentFile(); } fileMap.put("path", new BEValue(filePath)); fileInfo.add(new BEValue(fileMap)); } info.put("files", new BEValue(fileInfo)); info.put("pieces", new BEValue(Torrent.hashFiles(files, pieceLength), Torrent.BYTE_ENCODING)); } torrent.put("info", new BEValue(info)); ByteArrayOutputStream baos = new ByteArrayOutputStream(); BEncoder.bencode(new BEValue(torrent), baos); return new Torrent(baos.toByteArray(), true); }
From source file:com.qwazr.store.store.StoreManager.java
/** * Get a File with a path relative to the ROOT_DIR. This API checks that the * file is a child of the ROOT_DIR/*from w w w . j av a 2s .c o m*/ * * @param relativePath * a relative path * @return a file relative to the ROOT_DIR * @throws IOException * if any I/O error occurs */ public final File getFile(String relativePath) throws IOException { if (StringUtils.isEmpty(relativePath) || relativePath.equals("/")) return rootDir; File finalFile = new File(rootDir, relativePath); File file = finalFile; while (file != null) { if (file.equals(rootDir)) return finalFile; file = file.getParentFile(); } throw new IOException("Permission denied."); }
From source file:net.technicpack.minecraftcore.install.tasks.CopyDylibJnilibTask.java
@Override public void runTask(InstallTasksQueue queue) throws IOException, InterruptedException { File dylib = new File(new File(modpack.getBinDir(), "natives"), "liblwjgl.dylib"); File jnilib = new File(new File(modpack.getBinDir(), "natives"), "liblwjgl.jnilib"); File betterLib = getBetterLib(dylib, jnilib); if (!betterLib.exists()) return;/*from ww w. j a v a 2 s. c om*/ File worseLib = dylib; if (worseLib.equals(betterLib)) worseLib = jnilib; if (betterLib.exists() && worseLib.exists()) { String betterMd5 = MD5Utils.getMD5(betterLib); if (MD5Utils.checkMD5(worseLib, betterMd5)) return; } FileUtils.copyFile(betterLib, worseLib); }