From 054ab20402a5b4f5927e1eda96d81a40ef016b9d Mon Sep 17 00:00:00 2001 From: Andrew Resch Date: Sat, 4 Jul 2009 23:59:38 +0000 Subject: [PATCH] Use deluge.configmanager.get_config_dir() to find the state folder location since the 'state_location' key in the config may be wrong if the config folder has changed --- deluge/core/torrentmanager.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deluge/core/torrentmanager.py b/deluge/core/torrentmanager.py index ed16ffba8..b538d0114 100644 --- a/deluge/core/torrentmanager.py +++ b/deluge/core/torrentmanager.py @@ -500,7 +500,7 @@ class TorrentManager(component.Component): try: log.debug("Opening torrent state file for load.") state_file = open( - os.path.join(self.config["state_location"], "torrents.state"), "rb") + os.path.join(deluge.configmanager.get_config_dir(), "state", "torrents.state"), "rb") state = cPickle.load(state_file) state_file.close() except (EOFError, IOError, Exception), e: @@ -569,7 +569,7 @@ class TorrentManager(component.Component): try: log.debug("Saving torrent state file.") state_file = open( - os.path.join(self.config["state_location"], "torrents.state.new"), + os.path.join(deluge.configmanager.get_config_dir(), "state", "torrents.state.new"), "wb") cPickle.dump(state, state_file) state_file.flush() @@ -582,8 +582,8 @@ class TorrentManager(component.Component): # We have to move the 'torrents.state.new' file to 'torrents.state' try: shutil.move( - os.path.join(self.config["state_location"], "torrents.state.new"), - os.path.join(self.config["state_location"], "torrents.state")) + os.path.join(deluge.configmanager.get_config_dir(), "state", "torrents.state.new"), + os.path.join(deluge.configmanager.get_config_dir(), "state", "torrents.state")) except IOError: log.warning("Unable to save state file.") return True