You've already forked lazarus-ccr
LazEdit: EditorPageControl: Fix not being able to save hidden files on Windows.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2991 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -679,9 +679,21 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TEditor.SaveToFileUtf8(const Utf8Fn: String);
|
procedure TEditor.SaveToFileUtf8(const Utf8Fn: String);
|
||||||
|
var
|
||||||
|
Attr: LongInt;
|
||||||
begin
|
begin
|
||||||
try
|
try
|
||||||
|
Attr := FileGetAttrUTF8(Utf8Fn);
|
||||||
|
//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}
|
||||||
|
if ((Attr and faHidden) = faHidden) then FileSetAttrUtf8(Utf8Fn, Attr and (not faHidden));
|
||||||
|
{$endif}
|
||||||
Lines.SaveToFile(Utf8Fn);
|
Lines.SaveToFile(Utf8Fn);
|
||||||
|
{$ifdef windows}
|
||||||
|
if ((Attr and faHidden) = faHidden) then FileSetAttrUtf8(Utf8Fn, Attr or faHidden or faArchive);
|
||||||
|
{$endif}
|
||||||
Modified := False;
|
Modified := False;
|
||||||
SetFileName(Utf8Fn, AutoFileTypeDetection and (not FNoFileTypeChangeOnSave));
|
SetFileName(Utf8Fn, AutoFileTypeDetection and (not FNoFileTypeChangeOnSave));
|
||||||
except
|
except
|
||||||
|
Reference in New Issue
Block a user