Plugins can now have a folder for plugin related data
Path can be queried from settings.
This commit is contained in:
parent
22710ccfb3
commit
7e6ddaf0d6
2 changed files with 13 additions and 1 deletions
|
|
@ -426,6 +426,17 @@ class PluginSettings(object):
|
|||
filename += ".log"
|
||||
return os.path.join(self.settings.getBaseFolder("logs"), filename)
|
||||
|
||||
def get_plugin_data_folder(self):
|
||||
"""
|
||||
Retrieves the path to a data folder specifically for the plugin.
|
||||
|
||||
Plugins may use this for storing additional data.
|
||||
"""
|
||||
path = os.path.join(self.settings.getBaseFolder("data"), self.plugin_key)
|
||||
if not os.path.isdir(path):
|
||||
os.makedirs(path)
|
||||
return path
|
||||
|
||||
def __getattr__(self, item):
|
||||
all_access_methods = self.access_methods.keys() + self.deprecated_access_methods.keys()
|
||||
if item in all_access_methods:
|
||||
|
|
|
|||
|
|
@ -156,7 +156,8 @@ default_settings = {
|
|||
"printerProfiles": None,
|
||||
"scripts": None,
|
||||
"translations": None,
|
||||
"generated": None
|
||||
"generated": None,
|
||||
"data": None
|
||||
},
|
||||
"temperature": {
|
||||
"profiles": [
|
||||
|
|
|
|||
Loading…
Reference in a new issue