diff options
author | Bram Moolenaar <Bram@vim.org> | 2006-02-28 23:52:23 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2006-02-28 23:52:23 +0000 |
commit | 03f4855fc252dd389622715dd56cbc49423057ba (patch) | |
tree | c012f29a3c1c0f89b959e1a73105eda82afc4060 /src/os_win32.c | |
parent | b388adb1887c50d351cff7d15227e837303a64cb (diff) | |
download | vim-git-03f4855fc252dd389622715dd56cbc49423057ba.tar.gz |
updated for version 7.0210
Diffstat (limited to 'src/os_win32.c')
-rw-r--r-- | src/os_win32.c | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/os_win32.c b/src/os_win32.c index 08df912ce..3aec6ac6a 100644 --- a/src/os_win32.c +++ b/src/os_win32.c @@ -2548,6 +2548,61 @@ mch_isdir(char_u *name) } /* + * Return TRUE if file "fname" has more than one link. + */ + int +mch_is_linked(char_u *fname) +{ + HANDLE hFile; + int res = 0; + BY_HANDLE_FILE_INFORMATION inf; +#ifdef FEAT_MBYTE + WCHAR *wn = NULL; + + if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) + wn = enc_to_ucs2(fname, NULL); + if (wn != NULL) + { + hFile = CreateFileW(wn, /* file name */ + GENERIC_READ, /* access mode */ + 0, /* share mode */ + NULL, /* security descriptor */ + OPEN_EXISTING, /* creation disposition */ + 0, /* file attributes */ + NULL); /* handle to template file */ + if (hFile == INVALID_HANDLE_VALUE + && GetLastError() == ERROR_CALL_NOT_IMPLEMENTED) + { + /* Retry with non-wide function (for Windows 98). */ + vim_free(wn); + wn = NULL; + } + } + if (wn == NULL) +#endif + hFile = CreateFile(fname, /* file name */ + GENERIC_READ, /* access mode */ + 0, /* share mode */ + NULL, /* security descriptor */ + OPEN_EXISTING, /* creation disposition */ + 0, /* file attributes */ + NULL); /* handle to template file */ + + if (hFile != INVALID_HANDLE_VALUE) + { + if (GetFileInformationByHandle(hFile, &inf) != 0 + && inf.nNumberOfLinks > 1) + res = 1; + CloseHandle(hFile); + } + +#ifdef FEAT_MBYTE + vim_free(wn); +#endif + return res; +} + +/* * Return TRUE if file or directory "name" is writable (not readonly). * Strange semantics of Win32: a readonly directory is writable, but you can't * delete a file. Let's say this means it is writable. |