Changeset 1490 for trunk


Ignore:
Timestamp:
12/04/19 17:10:37 (4 years ago)
Author:
bnemhaus
Message:

FrameDirectory Settings can now have paths included in them that are not valid directories.
The check for valid directories now happens in the ResourceManager when the load request is made.

Location:
trunk/src/org/expeditee/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/org/expeditee/gui/FrameUtils.java

    r1462 r1490  
    876876                        File filePath = Paths.get(FrameIO.PARENT_FOLDER).resolve(dirName).toFile();
    877877                        boolean locationExists = filePath.exists() && filePath.isDirectory();
    878                         if (isSpecialCase || locationExists) {
     878                        //if (isSpecialCase || locationExists) {
    879879                                if (dirName.endsWith(File.separator)) {
    880880                                        dirsToAdd.add(dirName);
     
    882882                                        dirsToAdd.add(dirName + File.separator);
    883883                                }
    884                         }
     884                        //}
    885885                }
    886886               
  • trunk/src/org/expeditee/gui/management/ResourceManager.java

    r1471 r1490  
    4242                } else {
    4343                        List<String> canditateDirectoriesForResource = frames.getDirectories();
    44                         for (String path: canditateDirectoriesForResource) {
    45                                 loaded = FrameIO.LoadKnownPath(path, frameName);
    46                                 if (loaded != null) {
    47                                         break;
     44                        for (String directoryStr: canditateDirectoriesForResource) {
     45                                File directory = new File(directoryStr);
     46                                if (directory.exists()) {
     47                                        loaded = FrameIO.LoadKnownPath(directoryStr, frameName);
     48                                        if (loaded != null) {
     49                                                break;
     50                                        }
    4851                                }
    4952                        }
     
    112115                // users settings frame.
    113116                File resourceFile = null;
    114                 for (String dir: canditateDirectoriesForResource) {
    115                         resourceFile = new File(dir + path);
    116                         if (resourceFile.exists() && !resourceFile.isDirectory()) {
    117                                 break;
     117                for (String dirStr: canditateDirectoriesForResource) {
     118                        File dir = new File(dirStr);
     119                        if (dir.exists()) {
     120                                File checkResourceFile = new File(dirStr + path);
     121                                if (checkResourceFile.exists() && !checkResourceFile.isDirectory()) {
     122                                        resourceFile = checkResourceFile;
     123                                        break;
     124                                }
    118125                        }
    119126                }
     
    128135                //              These are of the format "/packageA/packageB/filename".  For
    129136                //              example: "/org/expeditee/gui.management/ResourceManager.java"
    130                 if (resourceFile == null || !resourceFile.exists() || resourceFile.isDirectory()) {
     137                if (resourceFile == null/* || !resourceFile.exists() || resourceFile.isDirectory()*/) {
    131138                        // Prepare for case a.
    132139                        resourceFile = new File(path);
     
    177184                List<String> directories = audio.getDirectories(parentFrame);
    178185                directories.add(FrameIO.PARENT_FOLDER);
    179                 for (String directory: directories) {
    180                         Path pathToFile = Paths.get(directory).resolve(localFileName);
    181                         File file = pathToFile.toFile();
    182                         if (file.exists() && !file.isDirectory()) {
    183                                 return file;
    184                         }
     186                for (String directoryStr: directories) {
     187                        File directory = new File(directoryStr);
     188                        if (directory.exists()) {
     189                                Path directoryPath = Paths.get(directoryStr);
     190                                Path pathToFile = directoryPath.resolve(localFileName);
     191                                File file = pathToFile.toFile();
     192                                if (file.exists() && !file.isDirectory()) {
     193                                        return file;
     194                                }
     195                        }                       
    185196                }
    186197               
     
    260271                }
    261272               
    262                 private void refresh(String context) {
    263                        
     273                private void refresh(String context) {                 
    264274                        List<String> unresolved = source.getAbsoluteDirs();
    265275                        directories = resolve(unresolved, context);
Note: See TracChangeset for help on using the changeset viewer.