diff options
author | Stefan Hoffmann <stefan991@gmail.com> | 2014-04-25 16:01:41 +0200 |
---|---|---|
committer | Stefan Hoffmann <stefan991@gmail.com> | 2014-05-09 15:49:32 +0200 |
commit | edbb687b73877d8db8b1c6e376e3422bb85a11a9 (patch) | |
tree | f4b6af6d46561876e3aa559ca75621a92f7bbe3f /src/fileio.c | |
parent | f3dda65de157f2d7c35286018c20cbc7597ed748 (diff) | |
download | rneovim-edbb687b73877d8db8b1c6e376e3422bb85a11a9.tar.gz rneovim-edbb687b73877d8db8b1c6e376e3422bb85a11a9.tar.bz2 rneovim-edbb687b73877d8db8b1c6e376e3422bb85a11a9.zip |
replaced some mch_stat() with os_file_exists()
Diffstat (limited to 'src/fileio.c')
-rw-r--r-- | src/fileio.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/src/fileio.c b/src/fileio.c index 8f2639064a..d7ee26297c 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -3444,8 +3444,6 @@ nobackup: restore_backup: { - struct stat st; - /* * If we failed to open the file, we don't need a backup. Throw it * away. If we moved or removed the original file try to put the @@ -3460,11 +3458,13 @@ restore_backup: * In that case we leave the copy around. */ /* If file does not exist, put the copy in its place */ - if (mch_stat((char *)fname, &st) < 0) + if (!os_file_exists(fname)) { vim_rename(backup, fname); + } /* if original file does exist throw away the copy */ - if (mch_stat((char *)fname, &st) >= 0) + if (os_file_exists(fname)) { os_remove((char *)backup); + } } else { /* try to put the original file back */ vim_rename(backup, fname); @@ -3472,8 +3472,9 @@ restore_backup: } /* if original file no longer exists give an extra warning */ - if (!newfile && mch_stat((char *)fname, &st) < 0) + if (!newfile && !os_file_exists(fname)) { end = 0; + } } if (wfname != fname) @@ -3855,15 +3856,13 @@ restore_backup: char *org = (char *)modname(fname, p_pm, FALSE); if (backup != NULL) { - struct stat st; - /* * If the original file does not exist yet * the current backup file becomes the original file */ if (org == NULL) EMSG(_("E205: Patchmode: can't save original file")); - else if (mch_stat(org, &st) < 0) { + else if (!os_file_exists((char_u *)org)) { vim_rename(backup, (char_u *)org); free(backup); /* don't delete the file */ backup = NULL; @@ -5527,9 +5526,6 @@ vim_tempname ( #ifdef TEMPDIRNAMES static char *(tempdirs[]) = {TEMPDIRNAMES}; int i; -# ifndef EEXIST - struct stat st; -# endif /* * This will create a directory for private use by this instance of Vim. @@ -5580,7 +5576,7 @@ vim_tempname ( /* If mkdir() does not set errno to EEXIST, check for * existing file here. There is a race condition then, * although it's fail-safe. */ - if (mch_stat((char *)itmp, &st) >= 0) + if (os_file_exists(itmp)) continue; # endif # if defined(UNIX) |