List of usage examples for org.apache.commons.io FilenameUtils equalsNormalizedOnSystem
public static boolean equalsNormalizedOnSystem(String filename1, String filename2)
From source file:com.github.neio.filesystem.paths.TestDirectoryPath.java
@Test public void testPathEquals() { Directory directory = new DirectoryPath("./testTempDir/path/"); Assert.assertTrue("Test path was not equal", FilenameUtils.equalsNormalizedOnSystem("./testTempDir/path/", directory.getPath())); }
From source file:net.sourceforge.pmd.cpd.CPD.java
private void add(int fileCount, File file) throws IOException { if (configuration.skipDuplicates()) { // TODO refactor this thing into a separate class String signature = file.getName() + '_' + file.length(); if (current.contains(signature)) { System.err.println("Skipping " + file.getAbsolutePath() + " since it appears to be a duplicate file and --skip-duplicate-files is set"); return; }/*from w ww . j a va 2s . com*/ current.add(signature); } if (!FilenameUtils.equalsNormalizedOnSystem(file.getAbsoluteFile().getCanonicalPath(), file.getAbsolutePath())) { System.err.println("Skipping " + file + " since it appears to be a symlink"); return; } if (!file.exists()) { System.err.println("Skipping " + file + " since it doesn't exist (broken symlink?)"); return; } listener.addedFile(fileCount, file); SourceCode sourceCode = configuration.sourceCodeFor(file); configuration.tokenizer().tokenize(sourceCode, tokens); source.put(sourceCode.getFileName(), sourceCode); }
From source file:ome.services.scripts.RepoFile.java
public boolean matches(File file) { return FilenameUtils.equalsNormalizedOnSystem(absPath, file.getAbsolutePath()); }
From source file:org.panbox.desktop.common.gui.PanboxClientGUI.java
private void settingsApplyButtonActionPerformed(java.awt.event.ActionEvent evt) {// GEN-FIRST:event_settingsApplyButtonActionPerformed Settings s = Settings.getInstance(); boolean restartRequired = false; String selLang = ((SupportedLanguage) languageComboBox.getSelectedItem()).getShorthand(); if (!selLang.equals(s.getLanguage())) { s.setLanguage(selLang);//from w w w. j a va 2 s . co m // client.restartTrayIcon(); restartRequired = true; } if (!(expertModeCheckBox.isSelected() == s.getExpertMode())) { s.setExpertMode(expertModeCheckBox.isSelected()); } if (!(uriHandlerCheckbox.isSelected() == s.isUriHandlerSupported())) { s.setUriHandlerSupported(uriHandlerCheckbox.isSelected()); restartRequired = true; } if (uriHandlerCheckbox.isSelected() && !(clipboardHandlerCheckbox.isSelected() == s.isClipboardHandlerSupported())) { s.setClipboardHandlerSupported(clipboardHandlerCheckbox.isSelected()); restartRequired = true; } if (!(mailtoSchemeCheckbox.isSelected() == s.isMailtoSchemeSupported())) { s.setMailtoSchemeSupported(mailtoSchemeCheckbox.isSelected()); restartRequired = true; } File newConfDir = new File(settingsFolderTextField.getText()); File oldConfDir = new File(s.getConfDir()); if (!FilenameUtils.equalsNormalizedOnSystem(newConfDir.getAbsolutePath(), oldConfDir.getAbsolutePath())) { if (newConfDir.exists()) { s.setConfDir(FilenameUtils.normalizeNoEndSeparator(newConfDir.getAbsolutePath())); client.settingsFolderChanged(newConfDir); } else { JOptionPane.showMessageDialog(this, bundle.getString("client.settings.panboxConfDirNotExisting")); settingsFolderTextField.setText(s.getConfDir()); } } // If this is not true currently no IP-Address is available. So use the // current one. if (networkAddressComboBox.getModel().getSelectedItem() instanceof InetAddress) { InetAddress address = (InetAddress) networkAddressComboBox.getModel().getSelectedItem(); s.setPairingAddress(address); } // save csp specific settings if (selectedCSPContentPanel.getComponentCount() > 0) { Component c = selectedCSPContentPanel.getComponent(0); if ((c != null) && (c instanceof Flushable)) { try { ((Flushable) c).flush(); } catch (IOException e) { logger.error("Error flushing csp settings config panel!", e); } } else { logger.error("Invalid csp content panel content!"); } } String newPath = panboxFolderTextField.getText(); String oldPath = s.getMountDir(); if (!FilenameUtils.equalsNormalizedOnSystem(newPath, oldPath)) { s.setMountDir(newPath); // client.panboxFolderChanged(newPath); restartRequired = true; } if (restartRequired) { int ret = JOptionPane.showConfirmDialog(this, bundle.getString("PanboxClientGUI.restartMessage"), bundle.getString("PanboxClientGUI.restartMessage.title"), JOptionPane.YES_NO_OPTION); try { if (ret == JOptionPane.YES_OPTION) { client.restartApplication(); } } catch (IOException e) { logger.error("Error while restarting the appication!", e); JOptionPane.showMessageDialog(this, bundle.getString("PanboxClientGUI.restartError"), bundle.getString("error"), JOptionPane.ERROR_MESSAGE); } } // reset the buttons resetSettingsApplyDiscardButtons(); }
From source file:org.panbox.desktop.common.vfs.backend.VirtualMultiuserRootFile.java
public synchronized boolean existsAndChanged(VFSShare vfsShare) { for (VFSShare share : userShares) { if (share.getShareName().equals(vfsShare.getShareName())) { if (FilenameUtils.equalsNormalizedOnSystem(share.getBackend().getRoot().getPath(), vfsShare.getBackend().getRoot().getPath())) { return true; // exists and changed! } else { return false; // exists but didn't change }/* ww w.j a va 2s . co m*/ } } return false; // does not exist }
From source file:org.panbox.desktop.common.vfs.backend.VirtualRootVolume.java
public final boolean existsAndChanged(VFSShare vfsShare) { Iterator<VFSShare> it = shares.iterator(); while (it.hasNext()) { VFSShare share = it.next();/*from w ww .jav a 2s . c o m*/ if (share.getShareName().equals(vfsShare.getShareName())) { if (FilenameUtils.equalsNormalizedOnSystem(share.getBackend().getRoot().getPath(), vfsShare.getBackend().getRoot().getPath())) { return true; } else { return false; } } } return false; }
From source file:org.sonar.api.resources.DefaultProjectFileSystem.java
private static boolean containsFile(List<java.io.File> dirs, java.io.File cursor) { for (java.io.File dir : dirs) { if (FilenameUtils.equalsNormalizedOnSystem(dir.getAbsolutePath(), cursor.getAbsolutePath())) { return true; }//w w w. j av a 2 s .c o m } return false; }
From source file:org.sonar.api.scan.filesystem.PathResolver.java
private File parentDir(Collection<File> dirs, File cursor) { for (File dir : dirs) { if (FilenameUtils.equalsNormalizedOnSystem(dir.getAbsolutePath(), cursor.getAbsolutePath())) { return dir; }/*from www . j a v a2 s .com*/ } return null; }
From source file:org.sonar.api.scan.filesystem.PathResolver.java
private boolean containsFile(File dir, File cursor) { return FilenameUtils.equalsNormalizedOnSystem(dir.getAbsolutePath(), cursor.getAbsolutePath()); }
From source file:org.sonar.plugins.delphi.utils.DirectoryFileFilter.java
private static boolean containsFile(List<File> dirs, File cursor) { for (File dir : dirs) { if (FilenameUtils.equalsNormalizedOnSystem(dir.getAbsolutePath(), cursor.getAbsolutePath())) { return true; }/* ww w. j a v a2 s . c o m*/ } return false; }