Convert the passed in file name to an absolute file name. The file name may be relative to the PCG file being loaded, to the PCG directory or it may be absolute. @param inFileName The file name to be converted. @return The absolute file name, or null if the file cannot be found.
(String inFileName)
| 3141 | * @return The absolute file name, or null if the file cannot be found. |
| 3142 | */ |
| 3143 | private String makeFilenameAbsolute(String inFileName) |
| 3144 | { |
| 3145 | // Is it relative to this character file? |
| 3146 | File pcFile = new File(thePC.getFileName()); |
| 3147 | File inFile = new File(pcFile.getParentFile(), inFileName); |
| 3148 | if (inFile.exists()) |
| 3149 | { |
| 3150 | return inFile.getAbsolutePath(); |
| 3151 | } |
| 3152 | |
| 3153 | // Is it relative to the PCG directory? |
| 3154 | File pcgDir = new File(PCGenSettings.getPcgDir()); |
| 3155 | inFile = new File(pcgDir, inFileName); |
| 3156 | if (inFile.exists()) |
| 3157 | { |
| 3158 | return inFile.getAbsolutePath(); |
| 3159 | } |
| 3160 | |
| 3161 | // Is it absolute? |
| 3162 | inFile = new File(inFileName); |
| 3163 | if (inFile.exists()) |
| 3164 | { |
| 3165 | return inFile.getAbsolutePath(); |
| 3166 | } |
| 3167 | |
| 3168 | // We can't find it! |
| 3169 | return null; |
| 3170 | } |
| 3171 | |
| 3172 | /* |
| 3173 | * ############################################################### |
no test coverage detected