This commit is contained in:
MLH
2024-12-10 01:08:02 +01:00
parent 987144fc0c
commit 23e3863643

View File

@ -1,7 +1,5 @@
from calendar import c
import os
import shutil
from tabnanny import check
import yaml
import re
import sys
@ -25,7 +23,7 @@ def loadConfig(configPath):
if not config:
raise ValueError("Empty configuration file")
print("Configuration loaded successfully.\n")
print("Configuration loaded successfully.")
return config
except FileNotFoundError:
print(f"Error: Configuration file not found at ./{configPath}")
@ -59,13 +57,13 @@ def copySources(config, destinationDirectory):
# 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 {targetPath} to {targetPath}.")
raise ValueError(f"Absolute path incorrect: Corrected {checkTargetPath} to {targetPath}.")
else:
sourcePath = source
targetPath = os.path.join(destinationDirectory, os.path.basename(sourcePath))
#targetPath = os.path.normpath(os.path.join(destinationDirectory, os.path.basename(sourcePath).lstrip('./')))
#targetPath = os.path.join(destinationDirectory, os.path.basename(sourcePath))
targetPath = os.path.normpath(os.path.join(destinationDirectory, os.path.basename(sourcePath)))
# Check if source exists
if not os.path.exists(sourcePath):