Changeset 7516
- Timestamp:
- 2004-06-01T11:27:13+12:00 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gli/src/org/greenstone/gatherer/file/FileAssociationManager.java
r7092 r7516 58 58 for(int i = 0; i < entries.getLength(); i++) { 59 59 Element entry = (Element) entries.item(i); 60 String extension = entry.getAttribute(StaticStrings.EXTENSION_ATTRIBUTE);61 60 String command = MSMUtils.getValue(entry); 62 61 // If we encounter a command of ""... 63 62 if(command.length() == 0) { 64 // and if we are on windows, we try to automatically set this command.63 // if we are on windows, we default to the start command 65 64 if(Utility.isWindows()) { 66 // Create a dummy filename with the appropriate extension 67 String dummy_file = "dummy." + extension; 68 command = WinRegistry.openCommand(dummy_file); 69 // If this succeeded add the association. 70 if(command != null) { 71 // Remember to replace the dummy filename with %1 72 command = command.replaceAll(dummy_file, FILENAME_ARG); 73 // Replace the text in this node. 74 MSMUtils.setValue(entry, command); 65 if (Utility.isWindows9x()) { 66 MSMUtils.setValue(entry, StaticStrings.WIN_9X_OPEN_COMMAND); 67 } else { 68 MSMUtils.setValue(entry, StaticStrings.WIN_OPEN_COMMAND); 75 69 } 76 dummy_file = null;77 70 } 78 // and if we are on windows, we default to the open program79 if(Utility.isMac()) {71 // and if we are on mac, we default to the open program 72 else if(Utility.isMac()) { 80 73 MSMUtils.setValue(entry, StaticStrings.MAC_OPEN_COMMAND); 81 74 } 82 75 } 83 76 command = null; 84 extension = null;85 77 entry = null; 86 78 } … … 184 176 // If command is null, and we are on windows try searching the registry. 185 177 if(Utility.isWindows()) { 186 ///ystem.err.println("Is Windows");187 //command = WinRegistry.openCommand(filename);188 178 //try the start command 189 179 if (Utility.isWindows9x()) { … … 197 187 // If we are on a mac, default to using the open program 198 188 else if(Utility.isMac()) { 199 ///ystem.err.println("Is Mac");200 189 command = StaticStrings.MAC_OPEN_COMMAND; 201 190 }
Note:
See TracChangeset
for help on using the changeset viewer.