LazEdit: when calling FileGetAttrUTF8 check for feInvalidHandle.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@3036 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
lazarus-bart
2014-05-10 16:23:34 +00:00
parent ee011598e4
commit 203059b3df

View File

@ -683,11 +683,12 @@ var
Attr: LongInt;
begin
try
Attr := FileGetAttrUTF8(Utf8Fn);
{$ifdef windows}
//TFileStreamUtf8.Create fails on hidden files on Windows,
//because it uses FILE_ATTRIBUTE_NORMAL
//see http://msdn.microsoft.com/en-us/library/windows/desktop/aa363858%28v=vs.85%29.aspx
{$ifdef windows}
Attr := FileGetAttrUTF8(Utf8Fn);
if (Attr = feInvalidHandle) then Attr := 0;
if ((Attr and faHidden) = faHidden) then FileSetAttrUtf8(Utf8Fn, Attr and (not faHidden));
{$endif}
Lines.SaveToFile(Utf8Fn);