mirror of
https://github.com/PiBrewing/craftbeerpi4.git
synced 2024-11-09 17:07:43 +01:00
Merge pull request #69 from prash3r/move-dashboard-files
moves cbpi_dashboard_*.json to subfolder dashboard.
This commit is contained in:
commit
7c87a2b054
3 changed files with 9 additions and 13 deletions
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"elements": []
|
||||
}
|
|
@ -1,3 +0,0 @@
|
|||
{
|
||||
"elements": []
|
||||
}
|
|
@ -96,13 +96,13 @@ class ConfigFolder:
|
|||
['config.json', 'file'],
|
||||
['craftbeerpi.service', 'file'],
|
||||
['chromium.desktop', 'file'],
|
||||
['dashboard/cbpi_dashboard_1.json', 'file'],
|
||||
['dashboard/widgets', 'folder'],
|
||||
['dashboard', 'folder'],
|
||||
['dashboard/widgets', 'folder'],
|
||||
['fermenterrecipes', 'folder'],
|
||||
[self.logsFolderPath, 'folder'],
|
||||
['recipes', 'folder'],
|
||||
['upload', 'folder']
|
||||
#['dashboard/cbpi_dashboard_1.json', 'file'] no need to check - can be created with online editor
|
||||
]
|
||||
for checking in required_config_content:
|
||||
if self.inform_missing_content(self.check_for_file_or_folder(os.path.join(self.configFolderPath, checking[0]), checking[1])):
|
||||
|
@ -117,6 +117,13 @@ class ConfigFolder:
|
|||
print("of course you can also place your config files manually")
|
||||
print("***************************************************")
|
||||
return False
|
||||
|
||||
# if cbpi_dashboard_1.json doesnt exist at the new location (configFolderPath/dashboard)
|
||||
# we move every cbpi_dashboard_n.json file from the old location (configFolderPath) there.
|
||||
# this could be a config zip file restore from version 4.0.7.a4 or prior.
|
||||
if not (os.path.isfile(os.path.join(self.configFolderPath, 'dashboard', 'cbpi_dashboard_1.json'))):
|
||||
for file in glob.glob(os.path.join(self.configFolderPath, 'cbpi_dashboard_*.json')):
|
||||
shutil.move(file, os.path.join(self.configFolderPath, 'dashboard', os.path.basename(file)))
|
||||
|
||||
def inform_missing_content(self, whatsmissing : str):
|
||||
if whatsmissing == "":
|
||||
|
@ -163,11 +170,6 @@ class ConfigFolder:
|
|||
self.copyDefaultFileIfNotExists("craftbeerpi.service")
|
||||
self.copyDefaultFileIfNotExists("chromium.desktop")
|
||||
|
||||
if os.path.exists(os.path.join(self.configFolderPath, "dashboard", "cbpi_dashboard_1.json")) is False:
|
||||
srcfile = os.path.join(os.path.dirname(__file__), "config", "dashboard", "cbpi_dashboard_1.json")
|
||||
destfile = os.path.join(self.configFolderPath, "dashboard")
|
||||
shutil.copy(srcfile, destfile)
|
||||
|
||||
print("Config Folder created")
|
||||
|
||||
def create_home_folder_structure(configFolder):
|
||||
|
|
Loading…
Reference in a new issue