version 1.197, 2006/05/31 14:40:54
|
version 1.198, 2006/10/17 09:59:03
|
Line 2243 void SimplifyUrl (char **url)
|
Line 2243 void SimplifyUrl (char **url)
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
ThotBool NormalizeFile (char *src, char *target, ConvertionType convertion) |
ThotBool NormalizeFile (char *src, char *target, ConvertionType convertion) |
{ |
{ |
#ifndef _WINDOWS |
|
char *s; |
char *s; |
int i; |
int i; |
#endif /* _WINDOWS */ |
|
ThotBool change; |
|
int start_index; /* the first char that we'll copy */ |
int start_index; /* the first char that we'll copy */ |
|
ThotBool change; |
|
|
change = FALSE; |
change = FALSE; |
start_index = 0; |
start_index = 0; |
Line 2298 ThotBool NormalizeFile (char *src, char
|
Line 2296 ThotBool NormalizeFile (char *src, char
|
convertions except for the HOME_DIR ~ one */ |
convertions except for the HOME_DIR ~ one */ |
CleanCopyFileURL (target, src, convertion); |
CleanCopyFileURL (target, src, convertion); |
} |
} |
#ifndef _WINDOWS |
#ifdef _WINDOWS |
|
else if (src[0] == DIR_SEP && src[1] == DIR_SEP) |
|
{ |
|
s = getenv ("HOMEDRIVE"); |
|
strcpy (target, s); |
|
i = strlen (target); |
|
strcpy (&target[i], &src[1]); |
|
change = TRUE; |
|
} |
|
#else /* _WINDOWS */ |
else if (src[0] == '~') |
else if (src[0] == '~') |
{ |
{ |
/* it must be a URL typed in a text input field */ |
/* it must be a URL typed in a text input field */ |
/* do the HOME_DIR ~ substitution */ |
/* do the HOME_DIR ~ substitution */ |
s = TtaGetEnvString ("HOME"); |
s = TtaGetEnvString ("HOME"); |
strcpy (target, s); |
strcpy (target, s); |
#if 0 |
|
/* JK: invalidated this part of the code as it's simpler |
|
to add the DIR_SEP whenever we have something to add |
|
to the path rather than adding it systematically */ |
|
if (src[1] != DIR_SEP) |
|
strcat (target, DIR_STR); |
|
#endif |
|
i = strlen (target); |
i = strlen (target); |
strcpy (&target[i], &src[1]); |
strcpy (&target[i], &src[1]); |
change = TRUE; |
change = TRUE; |