List of usage examples for org.apache.commons.io FilenameUtils equalsNormalized
public static boolean equalsNormalized(String filename1, String filename2)
From source file:ch.unibas.fittingwizard.application.base.MoleculesDir.java
public boolean contains(File selectedDir) { return FilenameUtils.equalsNormalized(directory.getAbsolutePath(), selectedDir.getParent()); }
From source file:ch.unibas.fittingwizard.application.workflows.ExportFitWorkflow.java
private void copyToDestinationIfNecessary(List<File> exportedFiles, File destination) { destination.mkdir();// w w w .ja v a2 s .c o m logger.info("copyToDestinationIfNecessary"); for (File exported : exportedFiles) { boolean alreadyInDestination = FilenameUtils .equalsNormalized(exported.getParentFile().getAbsolutePath(), destination.getAbsolutePath()); if (!alreadyInDestination) { try { FileUtils.copyFileToDirectory(exported, destination); } catch (IOException e) { throw new RuntimeException( "Could not copy file to destination " + destination.getAbsolutePath(), e); } if (!exported.delete()) { logger.error("Exported file was not deleted."); } } else { logger.info("Skipping copying to destination, since export file is already in destination."); } } }
From source file:de.undercouch.vertx.lang.typescript.TestExamplesRunner.java
private void compile(File script, TypeScriptCompiler compiler, SourceFactory parentSourceFactory, File pathToTypings) throws IOException { String name = FilenameUtils.separatorsToUnix(script.getPath().replaceFirst("\\.js$", ".ts")); compiler.compile(name, new SourceFactory() { @Override//from w w w .j a v a 2s . c om public Source getSource(String filename, String baseFilename) throws IOException { if (FilenameUtils.equalsNormalized(filename, name)) { Source src = Source.fromFile(script, StandardCharsets.UTF_8); String srcStr = src.toString(); // find all required vertx modules Pattern requireVertx = Pattern .compile("var\\s+.+?=\\s*require\\s*\\(\\s*\"(vertx-.+?)\"\\s*\\)"); Matcher requireVertxMatcher = requireVertx.matcher(srcStr); List<String> modules = new ArrayList<>(); modules.add("vertx-js/vertx.d.ts"); modules.add("vertx-js/java.d.ts"); while (requireVertxMatcher.find()) { String mod = requireVertxMatcher.group(1); modules.add(mod); } // add default type definitions Path relPathToTypings = script.toPath().getParent().relativize(pathToTypings.toPath()); for (String mod : modules) { srcStr = "/// <reference path=\"" + FilenameUtils.separatorsToUnix(relPathToTypings.resolve(mod).toString()) + "\" />\n" + srcStr; } // replace 'var x = require("...")' by 'import x = require("...")' srcStr = srcStr.replaceAll("var\\s+(.+?=\\s*require\\s*\\(.+?\\))", "import $1"); return new Source(script.toURI(), srcStr); } return parentSourceFactory.getSource(filename, baseFilename); } }); }
From source file:com.uwsoft.editor.data.manager.PreferencesManager.java
private void cleanDuplicates(ArrayList<String> paths) { Array<Integer> duplicates = new Array<>(); for (int i = 0; i < paths.size() - 1; i++) { if (duplicates.contains(i, false)) continue; for (int j = i + 1; j < paths.size(); j++) { if (FilenameUtils.equalsNormalized(paths.get(i), paths.get(j))) { duplicates.add(j);//from w w w.j av a2 s .com } } } duplicates.sort(); duplicates.reverse(); for (int i = 0; i < duplicates.size; i++) { paths.remove((int) duplicates.get(i)); } }
From source file:ch.unibas.fittingwizard.application.Visualization.java
public void openFile(File file) { if (file != null) { boolean isDifferentFile = currentOpenFile == null || !FilenameUtils.equalsNormalized(currentOpenFile.getAbsolutePath(), file.getAbsolutePath()); if (jmolViewer != null && isDifferentFile) { String strError = jmolViewer.openFile(file.getAbsolutePath()); if (strError == null) { jmolViewer.scriptWait("select clear"); jmolViewer.clearSelection(); jmolViewer.setSelectionHalos(true); //jmolViewer.evalString(strScript); currentOpenFile = file;//from w w w . ja va 2 s . c om } else { logger.error("Error while loading XYZ file. " + strError); } } } }
From source file:randori.compiler.internal.driver.model.ApplicationModel.java
@Override protected boolean accept(ITypeNode node) { if (node == null) return false; // no -include-sources everything gets included (-source-path) Collection<File> sources = settings.getIncludeSources(); if (sources == null || sources.size() == 0) return true; // if incremental files have been passed, filter on them Collection<String> incrementals = settings.getIncrementalFiles(); if (incrementals != null && incrementals.size() > 0) { String path = FilenameNormalization.normalize(node.getSourcePath()); for (String filePath : incrementals) { if (FilenameUtils.equalsNormalized(path, filePath)) return true; }//from ww w .ja va 2 s . c om return false; } // filter out using the expanded -include-sources directory or files String path = FilenameNormalization.normalize(node.getSourcePath()); for (File file : sources) { if (FilenameUtils.equalsNormalized(path, file.getAbsolutePath())) return true; } return false; }