Changeset 14753 for gli/trunk/src
- Timestamp:
- 2007-11-01T12:02:57+13:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/gui/OpenCollectionDialog.java
r14063 r14753 39 39 import org.greenstone.gatherer.util.StaticStrings; 40 40 import org.greenstone.gatherer.util.Utility; 41 import org.greenstone.gatherer.shell.GShell; 42 import org.greenstone.gatherer.shell.GShellEvent; 43 import org.greenstone.gatherer.shell.GShellListener; 44 import org.greenstone.gatherer.shell.GShellProgressMonitor; 41 45 42 46 /** A dialog which provides a straight-forward access to the currently installed collections. It also will contain the ability to continue through to the original OpenCollectionDialog if your source collection is located somewhere other than the gsdl collect folder. */ … … 240 244 241 245 private TreeSet data; 246 static final public int COLLECT = 3; 242 247 243 248 public CollectionListModel() { … … 253 258 String collection_foldername = collection_folder.getName(); 254 259 if(collection_folder.isDirectory() && !collection_foldername.equals(StaticStrings.MODEL_COLLECTION_NAME)) { 255 // this 'file_name' has already been prefixed by 'etc' 256 String file_name = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE; 260 // this 'file_name' has already been prefixed by 'etc' 261 String file_name; 262 if (Gatherer.GS3){ 263 convertToGS3Collection(collection_folder); 264 file_name = Utility.CONFIG_GS3_FILE; 265 }else{ 266 file_name = Utility.CONFIG_FILE; 267 } 268 269 //String file_name = (Gatherer.GS3)? Utility.CONFIG_GS3_FILE : Utility.CONFIG_FILE; 257 270 File config_file = new File(collection_folder, file_name); 258 271 File collection_metadata_directory = new File(collection_folder, "metadata"); 259 272 if (collection_metadata_directory.exists() && config_file.exists()) { 260 273 BasicCollectionConfiguration collection_configuration = new BasicCollectionConfiguration(config_file); … … 287 300 return data.size(); 288 301 } 302 303 public void convertToGS3Collection(File collection_folder) { 304 305 File collect_cfg_file = new File(collection_folder.getAbsolutePath() + File.separator + "etc" + File.separator + "collect.cfg"); 306 File build_cfg_file = new File(collection_folder.getAbsolutePath() + File.separator+"index" + File.separator + "build.cfg"); 307 308 if (collect_cfg_file.exists() && build_cfg_file.exists()){ 309 // Generate the convert_coll_from_gs2.pl command 310 ArrayList command_parts_list = new ArrayList(); 311 if ((Utility.isWindows()) && (!Gatherer.isGsdlRemote)) { 312 command_parts_list.add(Configuration.perl_path); 313 command_parts_list.add("-S"); 314 } 315 command_parts_list.add(Configuration.getGS3ScriptPath() + "convert_coll_from_gs2.pl"); 316 command_parts_list.add("-collectdir"); 317 command_parts_list.add(collection_folder.getParent()); 318 command_parts_list.add(collection_folder.getName()); 319 320 // Run the convert_coll_from_gs2.pl command 321 String[] command_parts = (String[]) command_parts_list.toArray(new String[0]); 322 GShell process = new GShell(command_parts, GShell.CONVERT, COLLECT, null, null, GShell.GSHELL_CONVERT); 323 //process.addGShellListener(this); 324 process.run(); // Don't bother threading this... yet 325 326 collect_cfg_file.delete(); 327 build_cfg_file.delete(); 328 } 329 } 330 289 331 } 290 332
Note:
See TracChangeset
for help on using the changeset viewer.