diff options
author | Stefan Hoffmann <stefan991@gmail.com> | 2014-05-27 20:36:23 +0200 |
---|---|---|
committer | Stefan Hoffmann <stefan991@gmail.com> | 2014-06-27 13:59:29 +0200 |
commit | 21af178b1489d57dc808c9a8bfef724ef6dc3972 (patch) | |
tree | 835d74572f728fbc41366420f8a10645b200c7c3 /src | |
parent | 7340f619d72bdfd0a4ab456f728685bdef6b4d34 (diff) | |
download | rneovim-21af178b1489d57dc808c9a8bfef724ef6dc3972.tar.gz rneovim-21af178b1489d57dc808c9a8bfef724ef6dc3972.tar.bz2 rneovim-21af178b1489d57dc808c9a8bfef724ef6dc3972.zip |
FileID: refactor path.c to use `FileID`
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/path.c | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/nvim/path.c b/src/nvim/path.c index a0859180c9..093a13db7b 100644 --- a/src/nvim/path.c +++ b/src/nvim/path.c @@ -52,13 +52,13 @@ FileComparison path_full_compare(char_u *s1, char_u *s2, int checkname) char_u exp1[MAXPATHL]; char_u full1[MAXPATHL]; char_u full2[MAXPATHL]; - uv_stat_t st1, st2; + FileID file_id_1, file_id_2; expand_env(s1, exp1, MAXPATHL); - int r1 = os_stat(exp1, &st1); - int r2 = os_stat(s2, &st2); - if (r1 != OK && r2 != OK) { - // If os_stat() doesn't work, may compare the names. + bool id_ok_1 = os_get_file_id((char *)exp1, &file_id_1); + bool id_ok_2 = os_get_file_id((char *)s2, &file_id_2); + if (!id_ok_1 && !id_ok_2) { + // If os_get_file_id() doesn't work, may compare the names. if (checkname) { vim_FullName(exp1, full1, MAXPATHL, FALSE); vim_FullName(s2, full2, MAXPATHL, FALSE); @@ -68,10 +68,10 @@ FileComparison path_full_compare(char_u *s1, char_u *s2, int checkname) } return kBothFilesMissing; } - if (r1 != OK || r2 != OK) { + if (!id_ok_1 || !id_ok_2) { return kOneFileMissing; } - if (st1.st_dev == st2.st_dev && st1.st_ino == st2.st_ino) { + if (os_file_id_equal(&file_id_1, &file_id_2)) { return kEqualFiles; } return kDifferentFiles; |