Last active
August 29, 2015 14:09
-
-
Save barik/b1cd56f20b6a63e0f30e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static boolean shouldIgnoreOptionalProblems(char[][] folderNames, char[] fileName) { | |
if (folderNames == null || fileName == null) { | |
return false; | |
} | |
for (int i = 0, max = folderNames.length; i < max; i++) { | |
char[] folderName = folderNames[i]; | |
if (isParentOf(folderName, fileName)) { | |
return true; | |
} | |
} | |
return false; | |
} | |
private static boolean isParentOf(char[] folderName, char[] fileName) { | |
if (folderName.length >= fileName.length) { | |
return false; | |
} | |
if (fileName[folderName.length] != '\\' && fileName[folderName.length] != '/') { | |
return false; | |
} | |
for (int i = folderName.length - 1; i >= 0; i--) { | |
if (folderName[i] != fileName[i]) { | |
return false; | |
} | |
} | |
return true; | |
} |
kjlubick
commented
Nov 19, 2014
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment