cpitf.c; allow spaces in paths like "Program Files" as search path for spinit if in MS Windows
This commit is contained in:
parent
232ea80a57
commit
e71fa90f1c
|
|
@ -265,16 +265,30 @@ ft_cpinit(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Now source the standard startup file spinit or tclspinit. */
|
/* Now source the standard startup file spinit or tclspinit. */
|
||||||
|
|
||||||
/* jump over leading spaces */
|
|
||||||
for (copys = s = cp_tildexpand(Lib_Path); copys && *copys; ) {
|
for (copys = s = cp_tildexpand(Lib_Path); copys && *copys; ) {
|
||||||
|
/* jump over leading spaces */
|
||||||
s = skip_ws(s);
|
s = skip_ws(s);
|
||||||
#ifdef OUTDEBUG
|
#ifdef OUTDEBUG
|
||||||
printf("cpitf.c, spinit path is %s\n", s);
|
printf("cpitf.c, spinit path is %s\n", s);
|
||||||
#endif
|
#endif
|
||||||
|
#if defined(_MSC_VER) || defined(__MINGW32__) || defined(HAS_WINGUI)
|
||||||
|
/* MS Windows allows path names with spaces, e.g. "Program Files".
|
||||||
|
The old code below does not do then.
|
||||||
|
So just copy the whole string s into buf */
|
||||||
|
size_t sl = strlen(s);
|
||||||
|
if (sl >= BSIZE_SP) {
|
||||||
|
fprintf(cp_err, "Note: Cannot evaluate spinit, path is too long!\n");
|
||||||
|
tcap_init();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
size_t ii = 0;
|
||||||
|
for (r = buf; *s && ii < sl; r++, s++, ii++)
|
||||||
|
*r = *s;
|
||||||
|
#else
|
||||||
/* copy s into buf until space is seen, r is the actual position */
|
/* copy s into buf until space is seen, r is the actual position */
|
||||||
for (r = buf; *s && !isspace_c(*s); r++, s++)
|
for (r = buf; *s && !isspace_c(*s); r++, s++)
|
||||||
*r = *s;
|
*r = *s;
|
||||||
|
#endif
|
||||||
tfree(copys);
|
tfree(copys);
|
||||||
/* add a path separator to buf at actual position */
|
/* add a path separator to buf at actual position */
|
||||||
(void) strcpy(r, DIR_PATHSEP);
|
(void) strcpy(r, DIR_PATHSEP);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue