Mercurial > vim
comparison src/ex_cmds.c @ 3957:fc8b4a06af9d v7.3.734
updated for version 7.3.734
Problem: Cannot put help files in a sub-directory.
Solution: Make :helptags work for sub-directories. (Charles Campbell)
author | Bram Moolenaar <bram@vim.org> |
---|---|
date | Wed, 28 Nov 2012 16:06:22 +0100 |
parents | ece544e85821 |
children | 26c8b3b49f74 |
comparison
equal
deleted
inserted
replaced
3956:7120c70c42fe | 3957:fc8b4a06af9d |
---|---|
6342 EMSG2(_("E150: Not a directory: %s"), eap->arg); | 6342 EMSG2(_("E150: Not a directory: %s"), eap->arg); |
6343 return; | 6343 return; |
6344 } | 6344 } |
6345 | 6345 |
6346 #ifdef FEAT_MULTI_LANG | 6346 #ifdef FEAT_MULTI_LANG |
6347 /* Get a list of all files in the directory. */ | 6347 /* Get a list of all files in the help directory and in subdirectories. */ |
6348 STRCPY(NameBuff, dirname); | 6348 STRCPY(NameBuff, dirname); |
6349 add_pathsep(NameBuff); | 6349 add_pathsep(NameBuff); |
6350 STRCAT(NameBuff, "*"); | 6350 STRCAT(NameBuff, "**"); |
6351 if (gen_expand_wildcards(1, &NameBuff, &filecount, &files, | 6351 if (gen_expand_wildcards(1, &NameBuff, &filecount, &files, |
6352 EW_FILE|EW_SILENT) == FAIL | 6352 EW_FILE|EW_SILENT) == FAIL |
6353 || filecount == 0) | 6353 || filecount == 0) |
6354 { | 6354 { |
6355 EMSG2("E151: No match: %s", NameBuff); | 6355 EMSG2("E151: No match: %s", NameBuff); |
6434 | 6434 |
6435 static void | 6435 static void |
6436 helptags_one(dir, ext, tagfname, add_help_tags) | 6436 helptags_one(dir, ext, tagfname, add_help_tags) |
6437 char_u *dir; /* doc directory */ | 6437 char_u *dir; /* doc directory */ |
6438 char_u *ext; /* suffix, ".txt", ".itx", ".frx", etc. */ | 6438 char_u *ext; /* suffix, ".txt", ".itx", ".frx", etc. */ |
6439 char_u *tagfname; /* "tags" for English, "tags-fr" for French. */ | 6439 char_u *tagfname; /* "tags" for English, "tags-fr" for French. */ |
6440 int add_help_tags; /* add "help-tags" tag */ | 6440 int add_help_tags; /* add "help-tags" tag */ |
6441 { | 6441 { |
6442 FILE *fd_tags; | 6442 FILE *fd_tags; |
6443 FILE *fd; | 6443 FILE *fd; |
6444 garray_T ga; | 6444 garray_T ga; |
6445 int filecount; | 6445 int filecount; |
6447 char_u *p1, *p2; | 6447 char_u *p1, *p2; |
6448 int fi; | 6448 int fi; |
6449 char_u *s; | 6449 char_u *s; |
6450 int i; | 6450 int i; |
6451 char_u *fname; | 6451 char_u *fname; |
6452 int dirlen; | |
6452 # ifdef FEAT_MBYTE | 6453 # ifdef FEAT_MBYTE |
6453 int utf8 = MAYBE; | 6454 int utf8 = MAYBE; |
6454 int this_utf8; | 6455 int this_utf8; |
6455 int firstline; | 6456 int firstline; |
6456 int mix = FALSE; /* detected mixed encodings */ | 6457 int mix = FALSE; /* detected mixed encodings */ |
6457 # endif | 6458 # endif |
6458 | 6459 |
6459 /* | 6460 /* |
6460 * Find all *.txt files. | 6461 * Find all *.txt files. |
6461 */ | 6462 */ |
6463 dirlen = STRLEN(dir); | |
6462 STRCPY(NameBuff, dir); | 6464 STRCPY(NameBuff, dir); |
6463 add_pathsep(NameBuff); | 6465 STRCAT(NameBuff, "/**/*"); |
6464 STRCAT(NameBuff, "*"); | |
6465 STRCAT(NameBuff, ext); | 6466 STRCAT(NameBuff, ext); |
6466 if (gen_expand_wildcards(1, &NameBuff, &filecount, &files, | 6467 if (gen_expand_wildcards(1, &NameBuff, &filecount, &files, |
6467 EW_FILE|EW_SILENT) == FAIL | 6468 EW_FILE|EW_SILENT) == FAIL |
6468 || filecount == 0) | 6469 || filecount == 0) |
6469 { | 6470 { |
6520 if (fd == NULL) | 6521 if (fd == NULL) |
6521 { | 6522 { |
6522 EMSG2(_("E153: Unable to open %s for reading"), files[fi]); | 6523 EMSG2(_("E153: Unable to open %s for reading"), files[fi]); |
6523 continue; | 6524 continue; |
6524 } | 6525 } |
6525 fname = gettail(files[fi]); | 6526 fname = files[fi] + dirlen + 1; |
6526 | 6527 |
6527 # ifdef FEAT_MBYTE | 6528 # ifdef FEAT_MBYTE |
6528 firstline = TRUE; | 6529 firstline = TRUE; |
6529 # endif | 6530 # endif |
6530 while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int) | 6531 while (!vim_fgets(IObuff, IOSIZE, fd) && !got_int) |