Mercurial > vim
comparison src/os_win32.c @ 39:410fa1a31baf v7.0023
updated for version 7.0023
author | vimboss |
---|---|
date | Sun, 19 Dec 2004 22:46:22 +0000 |
parents | 125e80798a85 |
children | f529edb9bab3 |
comparison
equal
deleted
inserted
replaced
38:c524f99c7925 | 39:410fa1a31baf |
---|---|
4343 * system using pszOldFile as an alias (SFN) if we're renaming within the | 4343 * system using pszOldFile as an alias (SFN) if we're renaming within the |
4344 * same directory. For example, we're editing a file called | 4344 * same directory. For example, we're editing a file called |
4345 * filename.asc.txt by its SFN, filena~1.txt. If we rename filena~1.txt | 4345 * filename.asc.txt by its SFN, filena~1.txt. If we rename filena~1.txt |
4346 * to filena~1.txt~ (i.e., we're making a backup while writing it), the | 4346 * to filena~1.txt~ (i.e., we're making a backup while writing it), the |
4347 * SFN for filena~1.txt~ will be filena~1.txt, by default, which will | 4347 * SFN for filena~1.txt~ will be filena~1.txt, by default, which will |
4348 * cause all sorts of problems later in buf_write. So, we create an empty | 4348 * cause all sorts of problems later in buf_write(). So, we create an |
4349 * file called filena~1.txt and the system will have to find some other | 4349 * empty file called filena~1.txt and the system will have to find some |
4350 * SFN for filena~1.txt~, such as filena~2.txt | 4350 * other SFN for filena~1.txt~, such as filena~2.txt |
4351 */ | 4351 */ |
4352 if ((hf = CreateFile(pszOldFile, GENERIC_WRITE, 0, NULL, CREATE_NEW, | 4352 if ((hf = CreateFile(pszOldFile, GENERIC_WRITE, 0, NULL, CREATE_NEW, |
4353 FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) | 4353 FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) |
4354 return -5; | 4354 return -5; |
4355 if (!CloseHandle(hf)) | 4355 if (!CloseHandle(hf)) |
4536 * Version of open() that may use ucs2 file name. | 4536 * Version of open() that may use ucs2 file name. |
4537 */ | 4537 */ |
4538 int | 4538 int |
4539 mch_open(char *name, int flags, int mode) | 4539 mch_open(char *name, int flags, int mode) |
4540 { | 4540 { |
4541 /* _wopen() does not work with Borland C 5.5: creates a read-only file. */ | |
4542 # ifndef __BORLANDC__ | |
4541 WCHAR *wn; | 4543 WCHAR *wn; |
4542 int f; | 4544 int f; |
4543 | 4545 |
4544 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage | 4546 if (enc_codepage >= 0 && (int)GetACP() != enc_codepage) |
4545 # ifdef __BORLANDC__ | |
4546 /* Wide functions of Borland C 5.5 do not work on Windows 98. */ | |
4547 && g_PlatformId == VER_PLATFORM_WIN32_NT | |
4548 # endif | |
4549 ) | |
4550 { | 4547 { |
4551 wn = enc_to_ucs2(name, NULL); | 4548 wn = enc_to_ucs2(name, NULL); |
4552 if (wn != NULL) | 4549 if (wn != NULL) |
4553 { | 4550 { |
4554 f = _wopen(wn, flags, mode); | 4551 f = _wopen(wn, flags, mode); |
4558 /* Retry with non-wide function (for Windows 98). Can't use | 4555 /* Retry with non-wide function (for Windows 98). Can't use |
4559 * GetLastError() here and it's unclear what errno gets set to if | 4556 * GetLastError() here and it's unclear what errno gets set to if |
4560 * the _wopen() fails for missing wide functions. */ | 4557 * the _wopen() fails for missing wide functions. */ |
4561 } | 4558 } |
4562 } | 4559 } |
4560 # endif | |
4563 | 4561 |
4564 return open(name, flags, mode); | 4562 return open(name, flags, mode); |
4565 } | 4563 } |
4566 | 4564 |
4567 /* | 4565 /* |