Mercurial > vim
comparison src/memline.c @ 26018:c2d4e40a32a6 v8.2.3543
patch 8.2.3543: swapname has double slash when 'directory' ends in it
Commit: https://github.com/vim/vim/commit/8b0e62c93b6dad5ec5b2c7558d4f7b78c46216d2
Author: Bram Moolenaar <Bram@vim.org>
Date: Tue Oct 19 22:12:25 2021 +0100
patch 8.2.3543: swapname has double slash when 'directory' ends in it
Problem: Swapname has double slash when 'directory' ends in double slash.
(Shane Smith)
Solution: Remove the superfluous slash. (closes #8876)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Tue, 19 Oct 2021 23:15:03 +0200 |
parents | d7e1cf30728c |
children | 2815b25993fb |
comparison
equal
deleted
inserted
replaced
26017:7fd14e99c44a | 26018:c2d4e40a32a6 |
---|---|
2062 | 2062 |
2063 #if defined(UNIX) || defined(MSWIN) || defined(PROTO) | 2063 #if defined(UNIX) || defined(MSWIN) || defined(PROTO) |
2064 /* | 2064 /* |
2065 * Need _very_ long file names. | 2065 * Need _very_ long file names. |
2066 * Append the full path to name with path separators made into percent | 2066 * Append the full path to name with path separators made into percent |
2067 * signs, to dir. An unnamed buffer is handled as "" (<currentdir>/"") | 2067 * signs, to "dir". An unnamed buffer is handled as "" (<currentdir>/"") |
2068 * The last character in "dir" must be an extra slash or backslash, it is | |
2069 * removed. | |
2068 */ | 2070 */ |
2069 char_u * | 2071 char_u * |
2070 make_percent_swname(char_u *dir, char_u *name) | 2072 make_percent_swname(char_u *dir, char_u *name) |
2071 { | 2073 { |
2072 char_u *d = NULL, *s, *f; | 2074 char_u *d = NULL, *s, *f; |
2079 { | 2081 { |
2080 STRCPY(s, f); | 2082 STRCPY(s, f); |
2081 for (d = s; *d != NUL; MB_PTR_ADV(d)) | 2083 for (d = s; *d != NUL; MB_PTR_ADV(d)) |
2082 if (vim_ispathsep(*d)) | 2084 if (vim_ispathsep(*d)) |
2083 *d = '%'; | 2085 *d = '%'; |
2086 | |
2087 dir[STRLEN(dir) - 1] = NUL; // remove one trailing slash | |
2084 d = concat_fnames(dir, s, TRUE); | 2088 d = concat_fnames(dir, s, TRUE); |
2085 vim_free(s); | 2089 vim_free(s); |
2086 } | 2090 } |
2087 vim_free(f); | 2091 vim_free(f); |
2088 } | 2092 } |