Fix some config file locations when using a non-default config directory
This commit is contained in:
parent
be5e12e1e4
commit
8da20c042f
|
@ -151,7 +151,7 @@ class Core(component.Component):
|
||||||
def __save_session_state(self):
|
def __save_session_state(self):
|
||||||
"""Saves the libtorrent session state"""
|
"""Saves the libtorrent session state"""
|
||||||
try:
|
try:
|
||||||
open(deluge.common.get_default_config_dir("session.state"), "wb").write(
|
open(deluge.configmanager.get_config_dir("session.state"), "wb").write(
|
||||||
lt.bencode(self.session.state()))
|
lt.bencode(self.session.state()))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.warning("Failed to save lt state: %s", e)
|
log.warning("Failed to save lt state: %s", e)
|
||||||
|
@ -160,14 +160,14 @@ class Core(component.Component):
|
||||||
"""Loads the libtorrent session state"""
|
"""Loads the libtorrent session state"""
|
||||||
try:
|
try:
|
||||||
self.session.load_state(lt.bdecode(
|
self.session.load_state(lt.bdecode(
|
||||||
open(deluge.common.get_default_config_dir("session.state"), "rb").read()))
|
open(deluge.configmanager.get_config_dir("session.state"), "rb").read()))
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
log.warning("Failed to load lt state: %s", e)
|
log.warning("Failed to load lt state: %s", e)
|
||||||
|
|
||||||
def save_dht_state(self):
|
def save_dht_state(self):
|
||||||
"""Saves the dht state to a file"""
|
"""Saves the dht state to a file"""
|
||||||
try:
|
try:
|
||||||
dht_data = open(deluge.common.get_default_config_dir("dht.state"), "wb")
|
dht_data = open(deluge.configmanager.get_config_dir("dht.state"), "wb")
|
||||||
dht_data.write(lt.bencode(self.session.dht_state()))
|
dht_data.write(lt.bencode(self.session.dht_state()))
|
||||||
dht_data.close()
|
dht_data.close()
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|
|
@ -276,7 +276,7 @@ class PreferencesManager(component.Component):
|
||||||
|
|
||||||
def _on_set_dht(self, key, value):
|
def _on_set_dht(self, key, value):
|
||||||
log.debug("dht value set to %s", value)
|
log.debug("dht value set to %s", value)
|
||||||
state_file = deluge.common.get_default_config_dir("dht.state")
|
state_file = deluge.configmanager.get_config_dir("dht.state")
|
||||||
if value:
|
if value:
|
||||||
state = None
|
state = None
|
||||||
try:
|
try:
|
||||||
|
|
Loading…
Reference in New Issue