La macro `_absPath` prend deux paramètres : `i_root` (un chemin racine facultatif) et `i_path` (le chemin à vérifier). Elle normalise d'abord tous les séparateurs de chemin en utilisant le caractère '/'. Si `i_path` est vide, la macro ne fait rien. Si `i_path` n'est pas absolu (ne commence pas par '/' ou ne contient pas ':/' après un potentiel caractère de lecteur), et qu'un `i_root` est fourni, elle construit un chemin absolu en concaténant `i_root` et `i_path`. Elle assure également que `i_root` ne se termine pas par un '/'.
Analyse des données
Type : AUCUNE
La macro ne traite pas de données issues de sources externes, de SASHELP ou créées en interne. Elle manipule des chaînes de caractères (chemins) passées en paramètres macro.
1 Bloc de code
MACRO _absPath
Explication : Ce bloc définit la macro `_absPath`. Elle commence par vérifier si le paramètre `i_path` est vide ; si c'est le cas, elle quitte la macro. Ensuite, si `i_root` est non vide, elle normalise `i_root` en remplaçant les barres obliques inverses `\` par des barres obliques `/` et en supprimant toute barre oblique finale pour éviter les doubles barres obliques lors de la concaténation. Le paramètre `i_path` est également normalisé de la même manière. Enfin, la macro vérifie si `i_path` est déjà un chemin absolu (commençant par `/` ou `:/`). Si c'est le cas, elle retourne `i_path` tel quel. Sinon, si `i_root` n'est pas vide, elle concatène `i_root` et `i_path` avec une barre oblique. Si `i_root` est vide et `i_path` n'est pas absolu, elle retourne `i_path` non modifié.
Copié !
/**
\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 */
Ce matériel est fourni "tel quel" par We Are Cas. Il n'y a aucune garantie, expresse ou implicite, quant à la qualité marchande ou à l'adéquation à un usage particulier concernant le matériel ou le code contenu dans les présentes. We Are Cas n'est pas responsable des erreurs dans ce matériel tel qu'il existe maintenant ou existera, et We Are Cas ne fournit pas de support technique pour celui-ci.
Informations de Copyright : Copyright 2010-2023 HMS Analytical Software GmbH, http://www.analytical-software.de
SAS et tous les autres noms de produits ou de services de SAS Institute Inc. sont des marques déposées ou des marques de commerce de SAS Institute Inc. aux États-Unis et dans d'autres pays. ® indique un enregistrement aux États-Unis. WeAreCAS est un site communautaire indépendant et n'est pas affilié à SAS Institute Inc.
Ce site utilise des cookies techniques et analytiques pour améliorer votre expérience.
En savoir plus.