Mercurial > vim
comparison src/ex_cmds.c @ 19429:7096af834c42 v8.2.0272
patch 8.2.0272: ":helptags ALL" gives error for some directories
Commit: https://github.com/vim/vim/commit/414b79662786762256e756ece8ab4aaecbbf9bd1
Author: Bram Moolenaar <Bram@vim.org>
Date: Mon Feb 17 22:39:35 2020 +0100
patch 8.2.0272: ":helptags ALL" gives error for some directories
Problem: ":helptags ALL" gives error for directories without write
permission. (Mat?j Cepl)
Solution: Ignore errors for ":helptags ALL". (Ken Takata, closes #5026,
closes #5652)
author | Bram Moolenaar <Bram@vim.org> |
---|---|
date | Mon, 17 Feb 2020 22:45:03 +0100 |
parents | a961efb326e5 |
children | 9fbeb3bdf49e |
comparison
equal
deleted
inserted
replaced
19428:1f9e7e703f24 | 19429:7096af834c42 |
---|---|
5918 static void | 5918 static void |
5919 helptags_one( | 5919 helptags_one( |
5920 char_u *dir, // doc directory | 5920 char_u *dir, // doc directory |
5921 char_u *ext, // suffix, ".txt", ".itx", ".frx", etc. | 5921 char_u *ext, // suffix, ".txt", ".itx", ".frx", etc. |
5922 char_u *tagfname, // "tags" for English, "tags-fr" for French. | 5922 char_u *tagfname, // "tags" for English, "tags-fr" for French. |
5923 int add_help_tags) // add "help-tags" tag | 5923 int add_help_tags, // add "help-tags" tag |
5924 int ignore_writeerr) // ignore write error | |
5924 { | 5925 { |
5925 FILE *fd_tags; | 5926 FILE *fd_tags; |
5926 FILE *fd; | 5927 FILE *fd; |
5927 garray_T ga; | 5928 garray_T ga; |
5928 int filecount; | 5929 int filecount; |
5962 add_pathsep(NameBuff); | 5963 add_pathsep(NameBuff); |
5963 STRCAT(NameBuff, tagfname); | 5964 STRCAT(NameBuff, tagfname); |
5964 fd_tags = mch_fopen((char *)NameBuff, "w"); | 5965 fd_tags = mch_fopen((char *)NameBuff, "w"); |
5965 if (fd_tags == NULL) | 5966 if (fd_tags == NULL) |
5966 { | 5967 { |
5967 semsg(_("E152: Cannot open %s for writing"), NameBuff); | 5968 if (!ignore_writeerr) |
5969 semsg(_("E152: Cannot open %s for writing"), NameBuff); | |
5968 FreeWild(filecount, files); | 5970 FreeWild(filecount, files); |
5969 return; | 5971 return; |
5970 } | 5972 } |
5971 | 5973 |
5972 /* | 5974 /* |
6163 | 6165 |
6164 /* | 6166 /* |
6165 * Generate tags in one help directory, taking care of translations. | 6167 * Generate tags in one help directory, taking care of translations. |
6166 */ | 6168 */ |
6167 static void | 6169 static void |
6168 do_helptags(char_u *dirname, int add_help_tags) | 6170 do_helptags(char_u *dirname, int add_help_tags, int ignore_writeerr) |
6169 { | 6171 { |
6170 #ifdef FEAT_MULTI_LANG | 6172 #ifdef FEAT_MULTI_LANG |
6171 int len; | 6173 int len; |
6172 int i, j; | 6174 int i, j; |
6173 garray_T ga; | 6175 garray_T ga; |
6249 // Language "ab" uses ".abx" and "tags-ab". | 6251 // Language "ab" uses ".abx" and "tags-ab". |
6250 STRCPY(ext, ".xxx"); | 6252 STRCPY(ext, ".xxx"); |
6251 ext[1] = fname[5]; | 6253 ext[1] = fname[5]; |
6252 ext[2] = fname[6]; | 6254 ext[2] = fname[6]; |
6253 } | 6255 } |
6254 helptags_one(dirname, ext, fname, add_help_tags); | 6256 helptags_one(dirname, ext, fname, add_help_tags, ignore_writeerr); |
6255 } | 6257 } |
6256 | 6258 |
6257 ga_clear(&ga); | 6259 ga_clear(&ga); |
6258 FreeWild(filecount, files); | 6260 FreeWild(filecount, files); |
6259 | 6261 |
6260 #else | 6262 #else |
6261 // No language support, just use "*.txt" and "tags". | 6263 // No language support, just use "*.txt" and "tags". |
6262 helptags_one(dirname, (char_u *)".txt", (char_u *)"tags", add_help_tags); | 6264 helptags_one(dirname, (char_u *)".txt", (char_u *)"tags", add_help_tags, |
6265 ignore_writeerr); | |
6263 #endif | 6266 #endif |
6264 } | 6267 } |
6265 | 6268 |
6266 static void | 6269 static void |
6267 helptags_cb(char_u *fname, void *cookie) | 6270 helptags_cb(char_u *fname, void *cookie) |
6268 { | 6271 { |
6269 do_helptags(fname, *(int *)cookie); | 6272 do_helptags(fname, *(int *)cookie, TRUE); |
6270 } | 6273 } |
6271 | 6274 |
6272 /* | 6275 /* |
6273 * ":helptags" | 6276 * ":helptags" |
6274 */ | 6277 */ |
6298 dirname = ExpandOne(&xpc, eap->arg, NULL, | 6301 dirname = ExpandOne(&xpc, eap->arg, NULL, |
6299 WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE); | 6302 WILD_LIST_NOTFOUND|WILD_SILENT, WILD_EXPAND_FREE); |
6300 if (dirname == NULL || !mch_isdir(dirname)) | 6303 if (dirname == NULL || !mch_isdir(dirname)) |
6301 semsg(_("E150: Not a directory: %s"), eap->arg); | 6304 semsg(_("E150: Not a directory: %s"), eap->arg); |
6302 else | 6305 else |
6303 do_helptags(dirname, add_help_tags); | 6306 do_helptags(dirname, add_help_tags, FALSE); |
6304 vim_free(dirname); | 6307 vim_free(dirname); |
6305 } | 6308 } |
6306 } | 6309 } |
6307 | 6310 |
6308 /* | 6311 /* |