diff options
author | ramon <ramongomez@us.es> | 2009-10-19 12:48:35 +0000 |
---|---|---|
committer | ramon <ramongomez@us.es> | 2009-10-19 12:48:35 +0000 |
commit | e42f34ed09b02a78a78a4525d282aa456f37db6f (patch) | |
tree | f002b2a6ac6d1e2b758de7e800ff46af91b3b867 /client/engine/File.lib | |
parent | 8964f9b26b06f61e20fba15bfe4fb653cc1a31b5 (diff) |
FunciĆ³n ogCopyFile.
git-svn-id: https://opengnsys.es/svn/trunk@391 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client/engine/File.lib')
-rwxr-xr-x | client/engine/File.lib | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/client/engine/File.lib b/client/engine/File.lib index 22ef4649..8bee7358 100755 --- a/client/engine/File.lib +++ b/client/engine/File.lib @@ -10,18 +10,27 @@ ##### PRUEBAS -# ogGetPath [ str_repo | int_ndisk int_npart ] path_source [ str_repo | int_ndisk int_npart ] path_target +# ogCopyFile [ str_repo | int_ndisk int_npart ] path_source [ str_repo | int_ndisk int_npart ] path_target function ogCopyFile () { -local SOURCE TARGET +local ARGS SOURCE TARGET +ARGS="$@" case "$1" in - /*) SOURCE=$(ogGetFile "$1") # */ (necesario Doxygen) - shift ;; - [1-9]*) SOURCE=$(ogGetFile "$1" "$2" "$3") - shift 3 ;; - *) SOURCE=$(ogGetFile "$1" "$2") - shift 2 ;; + /*) # Camino completo. + SOURCE=$(ogGetPath "$1") + shift ;; + [1-9]*) # ndisco nparticiĆ³n. + SOURCE=$(ogGetPath "$1" "$2" "$3") + shift 3 ;; + *) # Otros: repo, cache, cdrom (no se permiten caminos relativos). + SOURCE=$(ogGetPath "$1" "$2") + shift 2 ;; esac - +#/// Comprobar fichero origen y directorio destino. +[ -n "$SOURCE" ] || ogRaiseError $OG_ERR_NOTFOUND "${ARGS% $*}" || return $? +TARGET=$(ogGetPath "$@") +[ -n "$TARGET" ] || ogRaiseError $OG_ERR_NOTFOUND "$@" || return $? +#/// Copiar fichero. +cp "$SOURCE" "$TARGET" # (definir posible error) } |