- Timestamp:
- 11/07/19 12:22:50 (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/expeditee/gui/management/ResourceManager.java
r1439 r1441 25 25 private static boolean commonInvalidated = false; 26 26 private static ResourceManager instance = new ResourceManager(); 27 private static ResolvedDirectoryList frames = instance.new ResolvedDirectoryList(FolderSettings.FrameDirs); 28 private static ResolvedDirectoryList images = instance.new ResolvedDirectoryList(FolderSettings.ImageDirs); 29 private static ResolvedDirectoryList audio = instance.new ResolvedDirectoryList(FolderSettings.AudioDirs); 30 31 /** 32 * Attempts to relativise a image path using the users the directories listed for images in their settings. 33 * @param path The path to attempt to relativise 34 * @param context The context to use. Most likely the Frame that the image is on. 35 * @return Returns the most relativised path if one exists, otherwise returns a copy of the ref parameter passed in. 36 */ 37 /*public static Path relativiseImagePath(Path path, Frame context) { 38 String pathStr = path.toString(); 39 40 // Consult the resolved images directory for a list of paths to relativise too. 41 List<String> directories = images.getDirectories(context); 42 43 // Find the longest match that can be used to relativise the path. 44 String longestMatch = ""; 45 for (String dir: directories) { 46 if (pathStr.startsWith(dir) && (dir.length() > longestMatch.length())) { 47 longestMatch = dir; 48 } 49 } 50 51 return Paths.get(pathStr.replace(longestMatch, "")); 52 }*/ 53 54 public static Path relativiseImagePath(Path path, Frame context) { 55 Path expediteeHome = Paths.get(FrameIO.PARENT_FOLDER); 56 if (path.startsWith(expediteeHome)) { 57 return expediteeHome.relativize(path); 58 } else { 59 return path; 60 } 61 } 62 27 protected static ResolvedDirectoryList frames = instance.new ResolvedDirectoryList(FolderSettings.FrameDirs); 28 protected static ResolvedDirectoryList images = instance.new ResolvedDirectoryList(FolderSettings.ImageDirs); 29 protected static ResolvedDirectoryList audio = instance.new ResolvedDirectoryList(FolderSettings.AudioDirs); 30 63 31 /** 64 32 * Creates a Frame object from an associated resour … … 256 224 } 257 225 258 pr ivateclass ResolvedDirectoryList {226 protected class ResolvedDirectoryList { 259 227 private List<String> directories = null; 260 228 private String contextFramesetPath = null;
Note:
See TracChangeset
for help on using the changeset viewer.