From ab77356a6a756e9c94044c3074c5d693bb2af4c6 Mon Sep 17 00:00:00 2001 From: Enrico Forestieri Date: Tue, 23 Feb 2010 16:22:27 +0000 Subject: [PATCH] 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 --- src/support/os_win32.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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); } -- 2.39.2