Checks if the given file is a PCGen character or party file based on the file extension. @param file the file to test @return {true} if a PCGen character or party file @see Constants#EXTENSION_CHARACTER_FILE @see Constants#EXTENSION_PARTY_FILE
(final File file)
| 145 | * @see Constants#EXTENSION_PARTY_FILE |
| 146 | */ |
| 147 | public static boolean isPCGenCharacterOrPartyFile(final File file) |
| 148 | { |
| 149 | // A directory strangely named "fred.pcg" is not a character file. |
| 150 | if (file.isDirectory()) |
| 151 | { |
| 152 | return false; |
| 153 | } |
| 154 | |
| 155 | final String name = getWindowsSafeFilename(file); |
| 156 | |
| 157 | return name.endsWith(Constants.EXTENSION_CHARACTER_FILE) || name.endsWith(Constants.EXTENSION_PARTY_FILE); |
| 158 | } |
| 159 | |
| 160 | /** |
| 161 | * It may turn out to be the case that this should be optimized further to |