John Pote wrote:
> I've seen this problem before with other apps (can't remember which). An 
> open file is only released for overwriting when the whole app is 
> terminated. When you click the close button on a tab window showing, 
> say, a text file the tab closes but the app seems to hold it open, 
> effectively locking the file against rewriting.
>
> Is it as simple as just needing to call the 'close' method once the file 
> is read? But there's the rub, this has to happen in the emulator rather 
> than eclipseme. If  copies of the deployed files are passed to the 
> emulator they won't be overwritable either as noted in an earlier email.
>   
Note the trap that on Windows a file is sometimes not deleted:
http://forum.java.sun.com/thread.jspa?forumID=4&threadID=158689

I once ended up with such a delete method which, in may case,
never failed to delete:

   private boolean deleteFile(File tempFile) {
      if (!tempFile.exists())
         return true;
      final int MAX = 100;
      boolean warn = false;
      int i=0;
      for (i=0; i<MAX; i++) {
         if (!tempFile.delete()) {
            warn = true;
            if (!tempFile.exists()) // calling double delete fails, so 
check here
               break;
            if (i == 0)
               log.fine(ME+": Deleting file " + 
tempFile.getAbsolutePath() + " failed");
            System.gc();
            if (!tempFile.delete()) {
               if (i == 0)
                  log.warning(ME+": Deleting file " + 
tempFile.getAbsolutePath() + " failed even after GC");
               try {
                  Thread.sleep(100);
               } catch (InterruptedException e) {
               }
            }
            else
               break;
         }
         else
            break;
      }
      if (i >= MAX) {
         log.severe(ME+": Deleting file " + tempFile.getAbsolutePath() + 
" failed, giving up");
         return false;
      }
      else {
         if (warn)
            log.info(ME+": Deleting file " + tempFile.getAbsolutePath() 
+ " finally succeeded after " + (i+1) + " tries");
         return true;
      }
   }

regards
Marcel

-- 
Marcel Ruff
http://www.xmlBlaster.org


-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Eclipseme-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/eclipseme-users

Reply via email to