From: Enrico Forestieri Date: Tue, 23 Feb 2010 16:22:27 +0000 (+0000) Subject: When using CREATE_NEW, CreateFile fails if the file already exists. X-Git-Tag: 2.0.0~3969 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=ab77356a6a756e9c94044c3074c5d693bb2af4c6;p=features.git When using CREATE_NEW, CreateFile fails if the file already exists. I intended that, but was forgetting to account for it. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33545 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/support/os_win32.cpp b/src/support/os_win32.cpp index 87899a838b..60c5915d09 100644 --- a/src/support/os_win32.cpp +++ b/src/support/os_win32.cpp @@ -287,7 +287,8 @@ static QString const get_short_path(QString const & long_path, file_access how) HANDLE h = CreateFileW((wchar_t *) long_path.utf16(), GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); - if (h == INVALID_HANDLE_VALUE) + if (h == INVALID_HANDLE_VALUE + && GetLastError() != ERROR_FILE_EXISTS) return long_path; CloseHandle(h); }