libgimp/gimpenv.c (gimp_path_parse) Don't try to handle tilde (~) at all

2000-05-16  Tor Lillqvist  <tml@iki.fi>

* libgimp/gimpenv.c (gimp_path_parse)
* app/gimprc.c (transform_path): Don't try to handle tilde (~) at
all on Windows. The tilde is used when mangling long file names
into 8.3 form, and some people have a HOME environment variable
that contains this kind of 8.3 path with a tilde. This causes
interesting effects if we expand a tilde in some gimprc variable
with $HOME, which contains a tilde, which we expand with $HOME,
etc.
This commit is contained in:
Tor Lillqvist 2000-05-15 22:47:36 +00:00 committed by Tor Lillqvist
parent 0015374e44
commit bc1db67d83
4 changed files with 36 additions and 2 deletions

View File

@ -1,3 +1,14 @@
2000-05-16 Tor Lillqvist <tml@iki.fi>
* libgimp/gimpenv.c (gimp_path_parse)
* app/gimprc.c (transform_path): Don't try to handle tilde (~) at
all on Windows. The tilde is used when mangling long file names
into 8.3 form, and some people have a HOME environment variable
that contains this kind of 8.3 path with a tilde. This causes
interesting effects if we expand a tilde in some gimprc variable
with $HOME, which contains a tilde, which we expand with $HOME,
etc.
2000-05-14 Tor Lillqvist <tml@iki.fi>
* plug-ins/common/gpb.c (gih_save_dialog): Fix typo introduced

View File

@ -1769,12 +1769,15 @@ transform_path (gchar *path,
tmp = path;
while (*tmp)
{
#ifndef G_OS_WIN32
if (*tmp == '~')
{
length += strlen (home);
tmp += 1;
}
else if (*tmp == '$')
else
#endif
if (*tmp == '$')
{
tmp += 1;
if (!*tmp || (*tmp != '{'))
@ -1795,6 +1798,19 @@ transform_path (gchar *path,
{
/* maybe token is an environment variable */
tmp2 = g_getenv (token);
#ifdef G_OS_WIN32
/* The default user gimprc on Windows references
* ${TEMP}, but not all Windows installations have that
* environment variable, even if it should be kinda
* standard. So special-case it.
*/
if (tmp2 == NULL &&
(g_strcasecmp (token, "temp") == 0 ||
g_strcasecmp (token, "tmp") == 0))
{
tmp2 = g_get_tmp_dir ();
}
#endif
if (tmp2 != NULL)
{
is_env = TRUE;
@ -1845,6 +1861,7 @@ transform_path (gchar *path,
while (*tmp)
{
#ifndef G_OS_WIN32
if (*tmp == '~')
{
*tmp2 = '\0';
@ -1852,7 +1869,9 @@ transform_path (gchar *path,
tmp2 += strlen (home);
tmp += 1;
}
else if (*tmp == '$')
else
#endif
if (*tmp == '$')
{
tmp += 1;
if (!*tmp || (*tmp != '{'))

View File

@ -303,12 +303,14 @@ gimp_path_parse (gchar *path,
if (!patharray[i])
break;
#ifndef G_OS_WIN32
if (*patharray[i] == '~')
{
dir = g_string_new (home);
g_string_append (dir, patharray[i] + 1);
}
else
#endif
{
dir = g_string_new (patharray[i]);
}

View File

@ -303,12 +303,14 @@ gimp_path_parse (gchar *path,
if (!patharray[i])
break;
#ifndef G_OS_WIN32
if (*patharray[i] == '~')
{
dir = g_string_new (home);
g_string_append (dir, patharray[i] + 1);
}
else
#endif
{
dir = g_string_new (patharray[i]);
}