make path-element->bytes strip trailing separators, if any
svn: r4664
This commit is contained in:
parent
8ccef02233
commit
cc51634826
|
@ -724,32 +724,35 @@ static Scheme_Object *path_to_bytes(int argc, Scheme_Object **argv)
|
||||||
1);
|
1);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int is_path_element(Scheme_Object *p)
|
static Scheme_Object *is_path_element(Scheme_Object *p)
|
||||||
{
|
{
|
||||||
Scheme_Object *base;
|
Scheme_Object *base, *fn;
|
||||||
int isdir;
|
int isdir;
|
||||||
|
|
||||||
scheme_split_path(SCHEME_PATH_VAL(p),
|
fn = scheme_split_path(SCHEME_PATH_VAL(p),
|
||||||
SCHEME_PATH_LEN(p),
|
SCHEME_PATH_LEN(p),
|
||||||
&base,
|
&base,
|
||||||
&isdir);
|
&isdir);
|
||||||
|
|
||||||
if (SCHEME_SYMBOLP(base))
|
if (SCHEME_SYMBOLP(base))
|
||||||
return 1;
|
return fn;
|
||||||
return 0;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static Scheme_Object *path_element_to_bytes(int argc, Scheme_Object **argv)
|
static Scheme_Object *path_element_to_bytes(int argc, Scheme_Object **argv)
|
||||||
{
|
{
|
||||||
Scheme_Object *p = argv[0];
|
Scheme_Object *p = argv[0], *pe;
|
||||||
|
|
||||||
if (!SCHEME_PATHP(p))
|
if (!SCHEME_PATHP(p))
|
||||||
scheme_wrong_type("path-element->bytes", "path", 0, argc, argv);
|
scheme_wrong_type("path-element->bytes", "path", 0, argc, argv);
|
||||||
|
|
||||||
if (!is_path_element(p))
|
pe = is_path_element(p);
|
||||||
|
|
||||||
|
if (!pe)
|
||||||
scheme_arg_mismatch("path-element->bytes",
|
scheme_arg_mismatch("path-element->bytes",
|
||||||
"path can be split or is not relative: ",
|
"path can be split or is not relative: ",
|
||||||
p);
|
p);
|
||||||
|
p = pe;
|
||||||
|
|
||||||
#ifdef UNIX_FILE_SYSTEM
|
#ifdef UNIX_FILE_SYSTEM
|
||||||
/* Drop ./ of ./~ prefix */
|
/* Drop ./ of ./~ prefix */
|
||||||
|
|
Loading…
Reference in New Issue
Block a user