summaryrefslogtreecommitdiffstats
path: root/client
diff options
context:
space:
mode:
authoririna <irinagomez@us.es>2014-11-05 09:50:01 +0000
committeririna <irinagomez@us.es>2014-11-05 09:50:01 +0000
commitad051ccf60de3307acf954d3b7f5a20bc87d2260 (patch)
tree639ac6e4e2533f93f70a36947e67b18f41d0bd7b /client
parenta43e90d7eb68758e34f0348f19ffc3ac404dd1d6 (diff)
ogGetPath: Vuelve a directorio inicial en caso de error.
git-svn-id: https://opengnsys.es/svn/branches/version1.0@4428 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'client')
-rwxr-xr-xclient/engine/File.lib6
1 files changed, 4 insertions, 2 deletions
diff --git a/client/engine/File.lib b/client/engine/File.lib
index e602b64d..a8536ea3 100755
--- a/client/engine/File.lib
+++ b/client/engine/File.lib
@@ -232,8 +232,11 @@ case $# in
return $? ;;
esac
-# Eliminar caracteres \c / iniciales, finales y duplicados.
+# Volver a directorio inicial en caso de error.
CURRENTDIR="$PWD"
+trap "cd $CURRENTDIR" RETURN
+
+# Eliminar caracteres \c / iniciales, finales y duplicados.
# /* (comentario Doxygen)
FILE="$(echo $FILE|sed -e 's/\(\/\)*\1/\//g' -e 's/^\///' -e 's/\/$//')"
PREVFILE=""
@@ -248,7 +251,6 @@ done
# (comentario Doxygen) */
# Muestra el camino Linux, quitando el / inicial duplicado.
[ "$FILEPATH" != "/" ] && echo ${FILEPATH#/}
-cd $CURRENTDIR
}