michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: Components.utils.import("resource://gre/modules/Services.jsm"); michael@0: michael@0: const Cc = Components.classes; michael@0: const Ci = Components.interfaces; michael@0: const Cr = Components.results; michael@0: michael@0: do_get_profile(); michael@0: michael@0: do_register_cleanup(function() { michael@0: Services.obs.notifyObservers(null, "quit-application", null); michael@0: }); michael@0: michael@0: var dirSvc = Cc["@mozilla.org/file/directory_service;1"]. michael@0: getService(Ci.nsIProperties); michael@0: michael@0: function importDatabaseFile(aFName) michael@0: { michael@0: var file = do_get_file(aFName); michael@0: var newFile = dirSvc.get("ProfD", Ci.nsIFile); michael@0: file.copyTo(newFile, "downloads.sqlite"); michael@0: } michael@0: michael@0: function cleanup() michael@0: { michael@0: // removing database michael@0: var dbFile = dirSvc.get("ProfD", Ci.nsIFile); michael@0: dbFile.append("downloads.sqlite"); michael@0: if (dbFile.exists()) michael@0: try { dbFile.remove(true); } catch(e) { /* stupid windows box */ } michael@0: } michael@0: michael@0: cleanup(); michael@0: