mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-04-19 03:58:05 -05:00
PSCP, PSFTP: don't duplicate slashes in dir_file_cat.
Now if a pathname ends with a slash already, we detect that (using the shiny new ptrlen_endswith), and don't bother putting another one in. No functional change, but this should improve the occasional error message, e.g. 'pscp remote:some.filename /' will now say it can't create /some.filename instead of //some.filename.
This commit is contained in:
parent
757c91e2de
commit
d62a369af8
@ -436,7 +436,10 @@ bool create_directory(const char *name)
|
|||||||
|
|
||||||
char *dir_file_cat(const char *dir, const char *file)
|
char *dir_file_cat(const char *dir, const char *file)
|
||||||
{
|
{
|
||||||
return dupcat(dir, "/", file, NULL);
|
ptrlen dir_pl = ptrlen_from_asciz(dir);
|
||||||
|
return dupcat(
|
||||||
|
dir, ptrlen_endswith(dir_pl, PTRLEN_LITERAL("/"), NULL) ? "" : "/",
|
||||||
|
file, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -451,7 +451,11 @@ bool create_directory(const char *name)
|
|||||||
|
|
||||||
char *dir_file_cat(const char *dir, const char *file)
|
char *dir_file_cat(const char *dir, const char *file)
|
||||||
{
|
{
|
||||||
return dupcat(dir, "\\", file, NULL);
|
ptrlen dir_pl = ptrlen_from_asciz(dir);
|
||||||
|
return dupcat(
|
||||||
|
dir, (ptrlen_endswith(dir_pl, PTRLEN_LITERAL("\\"), NULL) ||
|
||||||
|
ptrlen_endswith(dir_pl, PTRLEN_LITERAL("/"), NULL)) ? "" : "\\",
|
||||||
|
file, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
|
Loading…
x
Reference in New Issue
Block a user