File tree Expand file tree Collapse file tree 8 files changed +27
-0
lines changed
Tmain/errors-if-tags-exits-as-directory.d Expand file tree Collapse file tree 8 files changed +27
-0
lines changed Original file line number Diff line number Diff line change
1
+ 1
Original file line number Diff line number Diff line change
1
+ # Copyright: 2024 Masatake YAMATO
2
+ # License: GPL-2
3
+
4
+ CTAGS=$1
5
+
6
+ ${CTAGS} --quiet --options=NONE $0
Original file line number Diff line number Diff line change
1
+ ctags: "tags" already exists as a directory; I cannot write tag entries there.
2
+ Remove the directory or specify a file name with -o <tagfile> option.
Original file line number Diff line number Diff line change
1
+ *
2
+ ! .gitignore
Original file line number Diff line number Diff line change @@ -422,8 +422,17 @@ extern void openTagFile (void)
422
422
else
423
423
{
424
424
bool fileExists ;
425
+ bool directoryExists ;
425
426
426
427
TagFile .name = eStrdup (Option .tagFileName );
428
+
429
+ directoryExists = doesDirectoryExist (TagFile .name );
430
+ if (directoryExists )
431
+ error (FATAL ,
432
+ "\"%s\" already exists as a directory; I cannot write tag entries there.\n"
433
+ "Remove the directory or specify a file name with -o <tagfile> option." ,
434
+ TagFile .name );
435
+
427
436
fileExists = doesFileExist (TagFile .name );
428
437
if (fileExists && ! isTagFile (TagFile .name ))
429
438
error (FATAL ,
Original file line number Diff line number Diff line change @@ -480,6 +480,12 @@ extern void eStatFree (fileStatus *status)
480
480
}
481
481
}
482
482
483
+ extern bool doesDirectoryExist (const char * const fileName )
484
+ {
485
+ fileStatus * status = eStat (fileName );
486
+ return status -> exists && status -> isDirectory ;
487
+ }
488
+
483
489
extern bool doesFileExist (const char * const fileName )
484
490
{
485
491
fileStatus * status = eStat (fileName );
Original file line number Diff line number Diff line change @@ -86,6 +86,7 @@ extern void setCurrentDirectory (void);
86
86
extern fileStatus * eStat (const char * const fileName );
87
87
extern void eStatFree (fileStatus * status );
88
88
extern bool doesFileExist (const char * const fileName );
89
+ extern bool doesDirectoryExist (const char * const fileName );
89
90
extern bool doesExecutableExist (const char * const fileName );
90
91
extern bool isRecursiveLink (const char * const dirName );
91
92
extern bool isSameFile (const char * const name1 , const char * const name2 );
You can’t perform that action at this time.
0 commit comments