Changeset 427

Show
Ignore:
Timestamp:
2007-06-13 15:49:51 (2 years ago)
Author:
MaierMan
Message:

adding _cleanTmpDir, aimed to cleaning unknown .dtapart files from the tempPath.
Will not do anything if no tmppath is used (but destdir) due to performance concerns.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/chrome/content/dta/manager.js

    r426 r427  
    292292                return this._safeClose(); 
    293293        }, 
     294        _cleanTmpDir: function D__cleanTmpDir() { 
     295                if (!Prefs.tempLocation) { 
     296                        // cannot perform this action if we don't use a temp file 
     297                        // there might be far too many directories containing far too many tmpFiles. 
     298                        return; 
     299                } 
     300                let known = []; 
     301                for (d in Tree.all) { 
     302                        known.push(d.tmpFile.leafName); 
     303                } 
     304                let tmpEnum = Prefs.tempLocation.directoryEntries; 
     305                let unknown = [] 
     306                while (tmpEnum.hasMoreElements()) { 
     307                        let f = tmpEnum.getNext().QueryInterface(Ci.nsILocalFile); 
     308                        if (f.leafName.match(/\.dtapart$/) && known.indexOf(f.leafName) == -1) { 
     309                                unknown.push(f); 
     310                        } 
     311                } 
     312                unknown.forEach( 
     313                        function(f) { 
     314                                try { 
     315                                        f.remove(false); 
     316                                } 
     317                                catch(ex) { 
     318                                } 
     319                        } 
     320                ); 
     321        }, 
    294322        _safeCloseChunks: [], 
    295323        // this one will loop until all chunks and FINISHING are gone. 
     
    305333                // alright, we left the loop.. shutdown complete ;) 
    306334                SessionManager.save(); 
     335                try { 
     336                        this._cleanTmpDir(); 
     337                } catch(ex) {} 
    307338                self.close(); 
    308339                return true;