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.
This commit is contained in:
Thomas Wienecke
2014-03-14 22:55:14 +01:00
committed by Thiago de Arruda
parent c83e8b4dc7
commit 1949acc806
14 changed files with 51 additions and 37 deletions

View File

@@ -3324,12 +3324,12 @@ nobackup:
* delete an existing one, try to use another name.
* Change one character, just before the extension.
*/
if (!p_bk && mch_getperm(backup) >= 0) {
if (!p_bk && os_file_exists(backup)) {
p = backup + STRLEN(backup) - 1 - STRLEN(backup_ext);
if (p < backup) /* empty file name ??? */
p = backup;
*p = 'z';
while (*p > 'a' && mch_getperm(backup) >= 0)
while (*p > 'a' && os_file_exists(backup))
--*p;
/* They all exist??? Must be something wrong! */
if (*p == 'a') {
@@ -5497,7 +5497,7 @@ buf_check_timestamp (
}
} else if ((buf->b_flags & BF_NEW) && !(buf->b_flags & BF_NEW_W)
&& vim_fexists(buf->b_ffname)) {
&& os_file_exists(buf->b_ffname)) {
retval = 1;
mesg = _("W13: Warning: File \"%s\" has been created after editing started");
buf->b_flags |= BF_NEW_W;