Author: andar
Revision: 5448
Log:
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
Diff:
Modified: trunk/deluge/core/torrentmanager.py
===================================================================
--- trunk/deluge/core/torrentmanager.py 2009-07-04 23:06:14 UTC (rev 5447)
+++ trunk/deluge/core/torrentmanager.py 2009-07-04 23:59:38 UTC (rev 5448)
@@ -500,7 +500,7 @@
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 @@
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 @@
# 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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"deluge-commit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/deluge-commit?hl=en
-~----------~----~----~----~------~----~------~--~---