diff options
author | Karl Berry <karl@freefriends.org> | 2008-01-14 01:23:37 +0000 |
---|---|---|
committer | Karl Berry <karl@freefriends.org> | 2008-01-14 01:23:37 +0000 |
commit | 13e12240ca1e2232a10f302e2d030e8eeaa1354b (patch) | |
tree | 38d32ed09f94c6b23b6c7201299a915ba425e3dd /Build/source/texk/kpathsea/tilde.c | |
parent | 72a8586805bfdecad5305807e1dad56cbee24156 (diff) |
make ~ expand to USERPROFILE on Windows
git-svn-id: svn://tug.org/texlive/trunk@6222 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/kpathsea/tilde.c')
-rw-r--r-- | Build/source/texk/kpathsea/tilde.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Build/source/texk/kpathsea/tilde.c b/Build/source/texk/kpathsea/tilde.c index b92bfe12e38..7d01533d4fc 100644 --- a/Build/source/texk/kpathsea/tilde.c +++ b/Build/source/texk/kpathsea/tilde.c @@ -1,7 +1,7 @@ /* tilde.c: Expand user's home directories. - Copyright 1997, 98, 2005, Olaf Weber. - Copyright 1993, 95, 96, 97 Karl Berry. + Copyright 1997, 1998, 2005, Olaf Weber. + Copyright 1993, 1995, 1996, 1997, 2008 Karl Berry. This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public @@ -13,11 +13,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. - You should have received a copy of the GNU Lesser General Public - License along with this library; if not, write to the Free Software - Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA - -*/ + You should have received a copy of the GNU Lesser General Public License + along with this library; if not, see <http://www.gnu.org/licenses/>. */ #include <kpathsea/config.h> @@ -28,6 +25,11 @@ #include <pwd.h> #endif +#ifdef WIN32 +#define HOMEVAR "USERPROFILE" +#else +#define HOMEVAR "HOME" +#endif /* If NAME has a leading ~ or ~user, Unix-style, expand it to the user's home directory, and return a new malloced string. If no ~, or no @@ -62,7 +64,7 @@ kpse_tilde_expand P1C(const_string, name) /* If a bare tilde, return the home directory or `.'. (Very unlikely that the directory name will do anyone any good, but ... */ } else if (name[1] == 0) { - home = getenv ("HOME"); + home = getenv (HOMEVAR); if (!home) { home = "."; } @@ -72,7 +74,7 @@ kpse_tilde_expand P1C(const_string, name) Should really check for doubled intermediate slashes, too. */ } else if (IS_DIR_SEP (name[1])) { unsigned c = 1; - home = getenv ("HOME"); + home = getenv (HOMEVAR); if (!home) { home = "."; } |