diff options
author | Thomas Wienecke <wienecke.t@gmail.com> | 2014-03-14 22:55:14 +0100 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-03-15 11:50:22 -0300 |
commit | 1949acc806e89dc0d2766b2b41eae1cac3186642 (patch) | |
tree | 1baad3b84e7ce42b7394e8ccc66670845cc5ccaf /src/misc1.c | |
parent | c83e8b4dc74ba010e0279b67ef8ffa14103d89f6 (diff) | |
download | rneovim-1949acc806e89dc0d2766b2b41eae1cac3186642.tar.gz rneovim-1949acc806e89dc0d2766b2b41eae1cac3186642.tar.bz2 rneovim-1949acc806e89dc0d2766b2b41eae1cac3186642.zip |
Revive vim_fname (-> os_file_exists); fix misuse of mch_getperm.
* Move vim_fname from misc1 to os/fs:os_file_exists.
* Add unit tests for os_file_exists.
* Replace misuse of mch_getperm with os_file_exists.
Diffstat (limited to 'src/misc1.c')
-rw-r--r-- | src/misc1.c | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/misc1.c b/src/misc1.c index 91e5313c96..bb9b43dd0c 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -3828,18 +3828,6 @@ void preserve_exit(void) { } /* - * return TRUE if "fname" exists. - */ -int vim_fexists(char_u *fname) -{ - struct stat st; - - if (mch_stat((char *)fname, &st)) - return FALSE; - return TRUE; -} - -/* * Check for CTRL-C pressed, but only once in a while. * Should be used instead of ui_breakcheck() for functions that check for * each line in the file. Calling ui_breakcheck() each time takes too much @@ -4196,7 +4184,7 @@ unix_expandpath ( /* remove backslashes for the remaining components only */ if (*path_end != NUL) backslash_halve(buf + len + 1); - if (mch_getperm(buf) >= 0) { /* add existing file */ + if (os_file_exists(buf)) { /* add existing file */ #ifdef MACOS_CONVERT size_t precomp_len = STRLEN(buf)+1; char_u *precomp_buf = @@ -4782,7 +4770,7 @@ gen_expand_wildcards ( * "vim c:/" work. */ if (flags & EW_NOTFOUND) addfile(&ga, t, flags | EW_DIR | EW_FILE); - else if (mch_getperm(t) >= 0) + else if (os_file_exists(t)) addfile(&ga, t, flags); vim_free(t); } @@ -4884,7 +4872,7 @@ addfile ( int isdir; /* if the file/dir doesn't exist, may not add it */ - if (!(flags & EW_NOTFOUND) && mch_getperm(f) < 0) + if (!(flags & EW_NOTFOUND) && !os_file_exists(f)) return; #ifdef FNAME_ILLEGAL |