diff --git a/client/lib/engine/bin/FileLib.py b/client/lib/engine/bin/FileLib.py index 89a24d4..dc649d1 100755 --- a/client/lib/engine/bin/FileLib.py +++ b/client/lib/engine/bin/FileLib.py @@ -224,26 +224,27 @@ def ogGetPath (src=None, file=None): #print (f'f ({f}) prevfile ({prevfile})') return filepath - -def ogGetParentPath(*args): - # Variables locales. - PARENT = None - if "help" in args: - FileSystemLib.ogHelp("$FUNCNAME", "$FUNCNAME [ str_repo | int_ndisk int_npartition ] path_filepath", "$FUNCNAME \"/mnt/sda1/windows/system32\" ==> /mnt/sda1/WINDOWS", "$FUNCNAME REPO /etc/fstab ==> /opt/opengnsys/images/etc", "$FUNCNAME 1 1 \"/windows/system32\" ==> /mnt/sda1/WINDOWS") + + +#/** +# ogGetParentPath [ str_repo | int_ndisk int_npartition ] path_filepath +#@brief Metafunción que devuelve el camino del directorio padre. +#@see ogGetPath +#*/ ## + +#ogGetParentPath ([ str_repo | int_ndisk int_npartition ] path_filepath +#ogGetParentPath ('/mnt/sda1/windows/system32') ==> '/mnt/sda1/WINDOWS' +#ogGetParentPath ('REPO', '/etc/fstab') ==> '/opt/opengnsys/images/etc' +#ogGetParentPath ('1 1', '/windows/system32') ==> '/mnt/sda1/WINDOWS' +def ogGetParentPath (src=None, file=None): + if file is None: + SystemLib.ogRaiseError ([], ogGlobals.OG_ERR_FORMAT, '') return - # Procesar camino según el número de parámetros. - if len(args) == 1: - PARENT = os.path.dirname(args[0]) - elif len(args) == 2: - PARENT = f"{args[0]} {os.path.dirname(f'/{args[1]}')}" - elif len(args) == 3: - PARENT = f"{args[0]} {args[1]} {os.path.dirname(f'/{args[2]}')}" + if src is None: + return ogGetPath (file=os.path.dirname (file)) else: - SystemLib.ogRaiseError(OG_ERR_FORMAT) - return - - return ogGetPath(PARENT) + return ogGetPath (src=src, file=os.path.dirname('/'+file)) def ogIsNewerFile(*args): # Variables locales.