diff --git a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py index 43d2c34f2..863d73455 100644 --- a/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py +++ b/deluge/plugins/AutoAdd/deluge/plugins/autoadd/common.py @@ -14,10 +14,12 @@ from __future__ import unicode_literals -from os.path import join +import os.path -from deluge.common import resource_filename +from deluge.common import decode_bytes + +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) def get_resource(filename): - return resource_filename('deluge.plugins.autoadd', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) diff --git a/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py index 80fd67acc..f112dda95 100644 --- a/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py +++ b/deluge/plugins/Blocklist/deluge/plugins/blocklist/common.py @@ -9,15 +9,17 @@ from __future__ import unicode_literals +import os.path from functools import wraps -from os.path import join from sys import exc_info -from deluge.common import resource_filename +from deluge.common import decode_bytes + +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) def get_resource(filename): - return resource_filename('deluge.plugins.blocklist', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) def raises_errors_as(error): diff --git a/deluge/plugins/Execute/deluge/plugins/execute/common.py b/deluge/plugins/Execute/deluge/plugins/execute/common.py index 5adde6ef1..3977edd3b 100644 --- a/deluge/plugins/Execute/deluge/plugins/execute/common.py +++ b/deluge/plugins/Execute/deluge/plugins/execute/common.py @@ -9,10 +9,12 @@ from __future__ import unicode_literals -from os.path import join +import os.path -from deluge.common import resource_filename +from deluge.common import decode_bytes + +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) def get_resource(filename): - return resource_filename('deluge.plugins.execute', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) diff --git a/deluge/plugins/Extractor/deluge/plugins/extractor/common.py b/deluge/plugins/Extractor/deluge/plugins/extractor/common.py index 8353896d2..3977edd3b 100644 --- a/deluge/plugins/Extractor/deluge/plugins/extractor/common.py +++ b/deluge/plugins/Extractor/deluge/plugins/extractor/common.py @@ -9,10 +9,12 @@ from __future__ import unicode_literals -from os.path import join +import os.path -from deluge.common import resource_filename +from deluge.common import decode_bytes + +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) def get_resource(filename): - return resource_filename('deluge.plugins.extractor', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) diff --git a/deluge/plugins/Label/deluge/plugins/label/common.py b/deluge/plugins/Label/deluge/plugins/label/common.py index 1507b8bad..3977edd3b 100644 --- a/deluge/plugins/Label/deluge/plugins/label/common.py +++ b/deluge/plugins/Label/deluge/plugins/label/common.py @@ -9,10 +9,12 @@ from __future__ import unicode_literals -from os.path import join +import os.path -from deluge.common import resource_filename +from deluge.common import decode_bytes + +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) def get_resource(filename): - return resource_filename('deluge.plugins.label', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) diff --git a/deluge/plugins/Notifications/deluge/plugins/notifications/common.py b/deluge/plugins/Notifications/deluge/plugins/notifications/common.py index 64e3be290..c12754a40 100644 --- a/deluge/plugins/Notifications/deluge/plugins/notifications/common.py +++ b/deluge/plugins/Notifications/deluge/plugins/notifications/common.py @@ -15,19 +15,21 @@ from __future__ import unicode_literals import logging -from os.path import join +import os.path from twisted.internet import defer from deluge import component -from deluge.common import resource_filename +from deluge.common import decode_bytes from deluge.event import known_events log = logging.getLogger(__name__) +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) + def get_resource(filename): - return resource_filename('deluge.plugins.notifications', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) class CustomNotifications(object): diff --git a/deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py b/deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py index f0d9200a1..f6251de13 100644 --- a/deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py +++ b/deluge/plugins/Scheduler/deluge/plugins/scheduler/common.py @@ -13,10 +13,12 @@ from __future__ import unicode_literals -from os.path import join +import os.path -from deluge.common import resource_filename +from deluge.common import decode_bytes + +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) def get_resource(filename): - return resource_filename('deluge.plugins.scheduler', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) diff --git a/deluge/plugins/Stats/deluge/plugins/stats/common.py b/deluge/plugins/Stats/deluge/plugins/stats/common.py index 112731363..3977edd3b 100644 --- a/deluge/plugins/Stats/deluge/plugins/stats/common.py +++ b/deluge/plugins/Stats/deluge/plugins/stats/common.py @@ -9,10 +9,12 @@ from __future__ import unicode_literals -from os.path import join +import os.path -from deluge.common import resource_filename +from deluge.common import decode_bytes + +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) def get_resource(filename): - return resource_filename('deluge.plugins.stats', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) diff --git a/deluge/plugins/Toggle/deluge/plugins/toggle/common.py b/deluge/plugins/Toggle/deluge/plugins/toggle/common.py index a59472b36..d958ec1df 100644 --- a/deluge/plugins/Toggle/deluge/plugins/toggle/common.py +++ b/deluge/plugins/Toggle/deluge/plugins/toggle/common.py @@ -14,10 +14,12 @@ from __future__ import unicode_literals -from os.path import join +import os.path -from deluge.common import resource_filename +from deluge.common import decode_bytes + +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) def get_resource(filename): - return resource_filename('deluge.plugins.toggle', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) diff --git a/deluge/plugins/WebUi/deluge/plugins/webui/common.py b/deluge/plugins/WebUi/deluge/plugins/webui/common.py index f6a408559..10b97387d 100644 --- a/deluge/plugins/WebUi/deluge/plugins/webui/common.py +++ b/deluge/plugins/WebUi/deluge/plugins/webui/common.py @@ -13,10 +13,12 @@ from __future__ import unicode_literals -from os.path import join +import os.path -from deluge.common import resource_filename +from deluge.common import decode_bytes + +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) def get_resource(filename): - return resource_filename('deluge.plugins.webui', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) diff --git a/deluge/scripts/create_plugin.py b/deluge/scripts/create_plugin.py index 5ef6c2a8b..447cc5da6 100644 --- a/deluge/scripts/create_plugin.py +++ b/deluge/scripts/create_plugin.py @@ -210,12 +210,16 @@ COMMON = """ from __future__ import unicode_literals -from os.path import join +import os.path + +from deluge.common import decode_bytes + +BASE_PATH = decode_bytes(os.path.abspath(os.path.dirname(__file__))) -from deluge.common import resource_filename def get_resource(filename): - return resource_filename('deluge.plugins.%(safe_name)s', join('data', filename)) + return os.path.join(BASE_PATH, 'data', filename) + """ GTKUI = """