Example usage for org.apache.commons.io FilenameUtils equalsOnSystem

List of usage examples for org.apache.commons.io FilenameUtils equalsOnSystem

Introduction

In this page you can find the example usage for org.apache.commons.io FilenameUtils equalsOnSystem.

Prototype

public static boolean equalsOnSystem(String filename1, String filename2) 

Source Link

Document

Checks whether two filenames are equal using the case rules of the system.

Usage

From source file:org.openehealth.ipf.commons.lbs.store.DiskStore.java

private void ensureDirectoriesExist(File file) {
    File parentDir = file.getParentFile();
    String baseDirPath = fileSystemLayout.getBaseDir().getAbsolutePath();
    baseDirPath = FilenameUtils.normalizeNoEndSeparator(baseDirPath);
    String parentDirPath = parentDir.getAbsolutePath();
    parentDirPath = FilenameUtils.normalizeNoEndSeparator(parentDirPath);
    if (FilenameUtils.equalsOnSystem(parentDirPath, baseDirPath)) {
        return;//from   w  w  w.j ava 2  s.  c  om
    }

    if (!parentDir.mkdirs()) {
        throw new ResourceIOException(
                "Unable to create directory: parentDir=" + parentDirPath + ", baseDir=" + baseDirPath);
    }
}

From source file:org.panbox.desktop.common.vfs.backend.VirtualRootMultiuserVolume.java

private String _getRelativePath(VFSShare share, VirtualFile file) {
    if (share.contains(file)) {

        if (FilenameUtils.equalsOnSystem(share.getShareName(), file.getFileName())) {
            return File.separator + share.getShareName();
        } else {/*from  www.  ja  v  a 2  s .  com*/
            return share.getRelativePath(file);
        }
    } else {
        return null;
    }
}

From source file:org.panbox.desktop.common.vfs.backend.VirtualRootVolume.java

private String _getRelativePath(VFSShare share, VirtualFile file) {
    if (share.contains(file)) {

        if (FilenameUtils.equalsOnSystem(share.getShareName(), file.getFileName())
                || FilenameUtils.equalsOnSystem(share.getShareName(), file.getFileName())) {
            return File.separator + share.getShareName();
        } else {//  w  ww.  ja v a 2 s.co m
            return share.getRelativePath(file);
        }
    } else {
        return null;
    }
}