Changeset 18397 for gli/trunk/src/org
- Timestamp:
- 2009-01-15T18:51:49+13:00 (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gli/trunk/src/org/greenstone/gatherer/gui/ReplaceSrcDocWithHtmlPrompt.java
r18376 r18397 81 81 /** whether we were successful or not */ 82 82 private boolean successful; 83 83 /** The command output of a successful execution of the replace script 84 * containing the generated tailname of the replacement file */ 85 private String successfulOutput; 84 86 85 87 public ReplaceSrcDocWithHtmlPrompt(File[] source_files) { … … 180 182 if(event.getStatus() == GShell.OK) { 181 183 successful = true; 184 GShell process = (GShell)event.getSource(); 185 successfulOutput = process.getCommandOutput(); 186 process.resetCommandOutput(); 182 187 } 183 188 } … … 292 297 return 0; 293 298 } 294 return -1;299 return 1; 295 300 } 296 301 … … 354 359 // first run the replace process for all src files, and accumulate error exit values (0 means it's fine) 355 360 for(int i = 0; i < srcdoc_files.length; i++) { 356 int exit_value_this_time = 361 int exit_value_this_time = replaceSrcDoc(i); 357 362 exit_value += exit_value_this_time; // if all files successfully replaced, exit_value will stay at 0 358 363 … … 366 371 } else { 367 372 if (Gatherer.isGsdlRemote) { 373 //System.err.println("*****ReplaceSrcDocWithHtmlPrompt.java - run() - gsdl remote case"); 374 375 // Conversion may have renamed the file by URL- or base64-encoding it. 376 // The new replacement file's tailname is the last line of the script output. 377 String[] lines = successfulOutput.split("\n"); 378 String suffixlessFilename = lines[lines.length-1]; 379 String htmlFile = suffixlessFilename+".html"; 380 368 381 // Delete the local copy of the old source document file on the client side 369 382 // (it's already been replaced on the server side), and download the updated 370 383 // (html) file and any directory containing associated files 371 System.err.println("*****ReplaceSrcDocWithHtmlPrompt.java - run() - gsdl remote case");372 // not sure what the new file is renamed to, so at present still delete entire373 // containing directory and get the updated copy of this directory from remote server374 384 Utility.delete(srcdoc_files[i]); // remove the local copy of src doc 375 376 // let's get just the filename without the suffix377 String htmlFile = srcdoc_files[i].getName();378 int lastperiod = htmlFile.lastIndexOf('.');379 String suffixlessFilename = htmlFile.substring(0, lastperiod); // cut off suffix380 htmlFile = suffixlessFilename+".html"; // html filename381 385 382 386 // download the generated html file from the server side to put it … … 390 394 // If an associated_folder by such a name exists, download it 391 395 if(Gatherer.remoteGreenstoneServer.exists(CollectionManager.getLoadedCollectionName(), assoc_folder)) { 392 Gatherer.remoteGreenstoneServer.downloadCollectionFile(396 Gatherer.remoteGreenstoneServer.downloadCollectionFile( 393 397 CollectionManager.getLoadedCollectionName(), assoc_folder); 394 398 }
Note:
See TracChangeset
for help on using the changeset viewer.