From ceeeacb03291233d830d1c31ece406feab6ecde5 Mon Sep 17 00:00:00 2001 From: CodeDevMLH Date: Tue, 10 Dec 2024 01:17:19 +0100 Subject: [PATCH] some fixes regarding massages --- customize-WebUI.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/customize-WebUI.py b/customize-WebUI.py index 543f61f..95951fb 100644 --- a/customize-WebUI.py +++ b/customize-WebUI.py @@ -51,18 +51,21 @@ def copySources(config, destinationDirectory): # Distinguish between sources with explicit target and without if isinstance(source, dict): sourcePath = source['source'] - #targetPath = os.path.join(destinationDirectory, source['target']) + checkTargetPath = source['target'] # Check for absolute paths in target and correct them if necessary if os.path.isabs(checkTargetPath): targetPath = os.path.normpath(os.path.join(destinationDirectory, checkTargetPath.lstrip('./'))) raise ValueError(f"Absolute path incorrect: Corrected {checkTargetPath} to {targetPath}.") + else: + #targetPath = os.path.join(destinationDirectory, source['target']) # old code + targetPath = os.path.normpath(os.path.join(destinationDirectory, checkTargetPath)) else: sourcePath = source - #targetPath = os.path.join(destinationDirectory, os.path.basename(sourcePath)) + #targetPath = os.path.join(destinationDirectory, os.path.basename(sourcePath)) # old code targetPath = os.path.normpath(os.path.join(destinationDirectory, os.path.basename(sourcePath))) # Check if source exists @@ -90,7 +93,7 @@ def copySources(config, destinationDirectory): if srcMtime <= destMtime: print(f"Skipping {sourcePath}: Destination is up to date") break # Skip this source file/folder - else: + elif rule.get('mode') != 'update' and not os.path.exists(sourcePath): print(f"Should update {sourcePath} to {targetPath}, but {sourcePath} is not (yet) existing.") # Copy files or directories @@ -122,7 +125,7 @@ def copySources(config, destinationDirectory): errorList["copies"] += 1 continue - print("\nSource file & folder copy/replace process completed.\n") + print(f"\nSource file & folder copy/replace process completed with {errorList['copies']} errors.\n") def modifyFiles(config, destinationDirectory): @@ -182,7 +185,7 @@ def modifyFiles(config, destinationDirectory): errorList["modifications"] += 1 continue - print("\nFile modification process completed.\n") + print(f"\nFile modification process completed with {errorList['modifications']} errors.\n") def main():