refs #1101 add ogGetParentPath()
parent
4342a5c27e
commit
d49e01f9e2
|
@ -225,25 +225,26 @@ def ogGetPath (src=None, file=None):
|
||||||
|
|
||||||
return filepath
|
return filepath
|
||||||
|
|
||||||
def ogGetParentPath(*args):
|
|
||||||
# Variables locales.
|
#/**
|
||||||
PARENT = None
|
# ogGetParentPath [ str_repo | int_ndisk int_npartition ] path_filepath
|
||||||
if "help" in args:
|
#@brief Metafunción que devuelve el camino del directorio padre.
|
||||||
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")
|
#@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
|
return
|
||||||
|
|
||||||
# Procesar camino según el número de parámetros.
|
if src is None:
|
||||||
if len(args) == 1:
|
return ogGetPath (file=os.path.dirname (file))
|
||||||
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]}')}"
|
|
||||||
else:
|
else:
|
||||||
SystemLib.ogRaiseError(OG_ERR_FORMAT)
|
return ogGetPath (src=src, file=os.path.dirname('/'+file))
|
||||||
return
|
|
||||||
|
|
||||||
return ogGetPath(PARENT)
|
|
||||||
|
|
||||||
def ogIsNewerFile(*args):
|
def ogIsNewerFile(*args):
|
||||||
# Variables locales.
|
# Variables locales.
|
||||||
|
|
Loading…
Reference in New Issue