mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-30 15:10:16 +02:00
lcl, codetools: don't request exclusive rights when IDE reads/writes units
git-svn-id: trunk@18251 -
This commit is contained in:
parent
133caf74fd
commit
7467771ed0
@ -657,25 +657,26 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TSourceLog.LoadFromFile(const Filename: string): boolean;
|
function TSourceLog.LoadFromFile(const Filename: string): boolean;
|
||||||
var s: string;
|
var
|
||||||
|
s: string;
|
||||||
fs: TFileStream;
|
fs: TFileStream;
|
||||||
begin
|
begin
|
||||||
Result:=true;
|
Result := True;
|
||||||
try
|
try
|
||||||
fs:=TFileStream.Create(UTF8ToSys(Filename), fmOpenRead);
|
fs := TFileStream.Create(UTF8ToSys(Filename), fmOpenRead or fmShareDenyNone);
|
||||||
try
|
try
|
||||||
SetLength(s,fs.Size);
|
SetLength(s, fs.Size);
|
||||||
if s<>'' then
|
if s <> '' then
|
||||||
fs.Read(s[1],length(s));
|
fs.Read(s[1], length(s));
|
||||||
FDiskEncoding:='';
|
FDiskEncoding := '';
|
||||||
FMemEncoding:='';
|
FMemEncoding := '';
|
||||||
DecodeLoaded(Filename,s,FDiskEncoding,FMemEncoding);
|
DecodeLoaded(Filename, s, FDiskEncoding, FMemEncoding);
|
||||||
Source:=s;
|
Source := s;
|
||||||
finally
|
finally
|
||||||
fs.Free;
|
fs.Free;
|
||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
Result:=false;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -695,22 +696,25 @@ var
|
|||||||
s: String;
|
s: String;
|
||||||
begin
|
begin
|
||||||
//DebugLn('TSourceLog.SaveToFile Self=',DbgS(Self));
|
//DebugLn('TSourceLog.SaveToFile Self=',DbgS(Self));
|
||||||
Result:=true;
|
Result := True;
|
||||||
try
|
try
|
||||||
InvalidateFileStateCache;
|
InvalidateFileStateCache;
|
||||||
// keep filename case on disk
|
// keep filename case on disk
|
||||||
TheFilename:=FindDiskFilename(Filename);
|
TheFilename := FindDiskFilename(Filename);
|
||||||
fs:=TFileStream.Create(UTF8ToSys(TheFilename), fmCreate);
|
if FileExistsUTF8(TheFilename) then
|
||||||
|
fs := TFileStream.Create(UTF8ToSys(TheFilename), fmOpenWrite or fmShareDenyNone)
|
||||||
|
else
|
||||||
|
fs := TFileStream.Create(UTF8ToSys(TheFilename), fmCreate);
|
||||||
try
|
try
|
||||||
s:=Source;
|
s := Source;
|
||||||
EncodeSaving(Filename,s);
|
EncodeSaving(Filename, s);
|
||||||
if s<>'' then
|
if s <> '' then
|
||||||
fs.Write(s[1],length(s));
|
fs.Write(s[1], length(s));
|
||||||
finally
|
finally
|
||||||
fs.Free;
|
fs.Free;
|
||||||
end;
|
end;
|
||||||
except
|
except
|
||||||
Result:=false;
|
Result := False;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -723,9 +723,9 @@ begin
|
|||||||
if FileReadable then ;
|
if FileReadable then ;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function FileIsText(const AFilename: string; out FileReadable: boolean
|
function FileIsText(const AFilename: string; out FileReadable: boolean): boolean;
|
||||||
): boolean;
|
var
|
||||||
var fs: TFileStream;
|
fs: TFileStream;
|
||||||
Buf: string;
|
Buf: string;
|
||||||
Len, i: integer;
|
Len, i: integer;
|
||||||
NewLine: boolean;
|
NewLine: boolean;
|
||||||
@ -734,7 +734,7 @@ begin
|
|||||||
Result:=false;
|
Result:=false;
|
||||||
FileReadable:=true;
|
FileReadable:=true;
|
||||||
try
|
try
|
||||||
fs:=TFileStream.Create(UTF8ToSys(AFilename),fmOpenRead);
|
fs := TFileStream.Create(UTF8ToSys(AFilename), fmOpenRead or fmShareDenyNone);
|
||||||
try
|
try
|
||||||
// read the first 1024 bytes
|
// read the first 1024 bytes
|
||||||
Len:=1024;
|
Len:=1024;
|
||||||
|
Loading…
Reference in New Issue
Block a user