La macro `_absPath` toma dos parámetros: `i_root` (una ruta raíz opcional) e `i_path` (la ruta a verificar). Primero normaliza todos los separadores de ruta usando el carácter '/'. Si `i_path` está vacío, la macro no hace nada. Si `i_path` no es absoluta (no comienza con '/' o no contiene ':/' después de un potencial carácter de unidad), y se proporciona un `i_root`, construye una ruta absoluta concatenando `i_root` e `i_path`. También asegura que `i_root` no termine en '/'.
Análisis de datos
Type : NINGUNA
La macro no procesa datos de fuentes externas, de SASHELP o creados internamente. Manipula cadenas de caracteres (rutas) pasadas como parámetros de macro.
1 Bloque de código
MACRO _absPath
Explicación : Este bloque define la macro `_absPath`. Comienza verificando si el parámetro `i_path` está vacío; si es así, sale de la macro. Luego, si `i_root` no está vacío, normaliza `i_root` reemplazando las barras invertidas `\` por barras inclinadas `/` y eliminando cualquier barra inclinada final para evitar barras dobles al concatenar. El parámetro `i_path` también se normaliza de la misma manera. Finalmente, la macro verifica si `i_path` ya es una ruta absoluta (comenzando con `/` o `:/`). Si es así, devuelve `i_path` tal cual. De lo contrario, si `i_root` no está vacío, concatena `i_root` y `i_path` con una barra inclinada. Si `i_root` está vacío y `i_path` no es absoluto, devuelve `i_path` sin modificar.
¡Copiado!
/**
\file
\ingroup SASUNIT_UTIL
\brief check whether &i_path is absolute or empty. If not, append to &i_root.
\version \$Revision$\n \author \$Author$\n \date \$Date$\n
\sa For further information please refer to https://github.com/HMS-Analytical-Software/SASUnit/wiki/User%27s%20Guide/
Here you can find the SASUnit documentation, release notes and license information.
\sa \$HeadURL$\n \copyright Copyright 2010-2023 HMS Analytical Software GmbH, http://www.analytical-software.de
This file is part of SASUnit, the Unit testing framework for SAS(R) programs.
For copyright information and terms of usage under the GNU Lesser General Public License see included file README.md
or https://github.com/HMS-Analytical-Software/SASUnit/wiki/readme/.
\param i_root optional: root path
\param i_path path to be checked
\return modified path
*/ /** \cond */
%MACRO _absPath (i_root
,i_path
);
%IF "&i_path" EQ "" %THEN %RETURN;
%IF %length(&i_root) %THEN %DO;
%LET i_root = %qsysfunc(translate(&i_root,/,\));
%IF "%substr(&i_root,%length(&i_root),1)" = "/" %THEN
%LET i_root=%substr(&i_root,1,%eval(%length(&i_root)-1));
%END;
%LET i_path = %qsysfunc(translate(&i_path,/,\));
%IF "%substr(&i_path,1,1)" = "/" OR "%substr(&i_path,2,2)" = ":/" %THEN &i_path;
%ELSE %IF %length(&i_root) %THEN &i_root/&i_path;
%ELSE &i_path;
%MEND _absPath;
/** \endcond */
1
/**
2
\file
3
\ingroup SASUNIT_UTIL
4
5
\brief check whether &i_path is absolute or empty. If not, append to &i_root.
6
7
\version \$Revision$
8
\author \$Author$
9
\date \$Date$
10
11
\sa For further information please refer to https://github.com/HMS-Analytical-Software/SASUnit/wiki/User%27s%20Guide/
12
Here you can find the SASUnit documentation, release notes and license information.
13
\sa \$HeadURL$
14
\copyright Copyright 2010-2023 HMS Analytical Software GmbH, http://www.analytical-software.de
15
This file is part of SASUnit, the Unit testing framework for SAS(R) programs.
16
For copyright information and terms of usage under the GNU Lesser General Public License see included file README.md
17
or https://github.com/HMS-Analytical-Software/SASUnit/wiki/readme/.
%IF"%substr(&i_path,1,1)" = "/" OR "%substr(&i_path,2,2)" = ":/" %THEN &i_path;
38
%ELSE %IF %LENGTH(&i_root) %THEN &i_root/&i_path;
39
%ELSE &i_path;
40
41
%MEND _absPath;
42
/** \endcond */
Este material se proporciona "tal cual" por We Are Cas. No hay garantías, expresas o implícitas, en cuanto a la comerciabilidad o idoneidad para un propósito particular con respecto a los materiales o el código contenidos en este documento. We Are Cas no es responsable de los errores en este material tal como existe ahora o existirá, ni We Are Cas proporciona soporte técnico para el mismo.
Información de copyright : Copyright 2010-2023 HMS Analytical Software GmbH, http://www.analytical-software.de
SAS y todos los demás nombres de productos o servicios de SAS Institute Inc. son marcas registradas o marcas comerciales de SAS Institute Inc. en los EE. UU. y otros países. ® indica registro en los EE. UU. WeAreCAS es un sitio comunitario independiente y no está afiliado a SAS Institute Inc.
Este sitio utiliza cookies técnicas y analíticas para mejorar su experiencia.
Saber más.