mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 13:17:18 +02:00
IDEIntf: unicode file names
git-svn-id: trunk@46817 -
This commit is contained in:
parent
0dd577c576
commit
03a8f3b039
@ -21,8 +21,8 @@ unit IDETextConverter;
|
|||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, TypInfo, LCLProc, Controls, Forms, FileUtil, SrcEditorIntf,
|
Classes, SysUtils, TypInfo, LCLProc, Controls, Forms, FileUtil,
|
||||||
PropEdits;
|
LazUTF8Classes, SrcEditorIntf, PropEdits;
|
||||||
|
|
||||||
type
|
type
|
||||||
TCustomTextConverterTool = class;
|
TCustomTextConverterTool = class;
|
||||||
@ -414,7 +414,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
tctFile:
|
tctFile:
|
||||||
if FileExistsUTF8(FFilename) then begin
|
if FileExistsUTF8(FFilename) then begin
|
||||||
fs:=TFileStream.Create(UTF8ToSys(FFilename),fmOpenRead);
|
fs:=TFileStreamUTF8.Create(FFilename,fmOpenRead);
|
||||||
try
|
try
|
||||||
SetLength(FSource,fs.Size);
|
SetLength(FSource,fs.Size);
|
||||||
fs.Read(FSource[1],length(FSource));
|
fs.Read(FSource[1],length(FSource));
|
||||||
@ -446,6 +446,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
tctFile:
|
tctFile:
|
||||||
if FileExistsUTF8(FFilename) then begin
|
if FileExistsUTF8(FFilename) then begin
|
||||||
|
if FStrings is TStringListUTF8 then
|
||||||
|
FStrings.LoadFromFile(FFilename)
|
||||||
|
else
|
||||||
FStrings.LoadFromFile(UTF8ToSys(FFilename));
|
FStrings.LoadFromFile(UTF8ToSys(FFilename));
|
||||||
ResetFile;
|
ResetFile;
|
||||||
end;
|
end;
|
||||||
@ -469,7 +472,7 @@ begin
|
|||||||
case FCurrentType of
|
case FCurrentType of
|
||||||
tctSource:
|
tctSource:
|
||||||
begin
|
begin
|
||||||
fs:=TFileStream.Create(UTF8ToSys(FFilename),fmCreate);
|
fs:=TFileStreamUTF8.Create(FFilename,fmCreate);
|
||||||
try
|
try
|
||||||
if FSource<>'' then begin
|
if FSource<>'' then begin
|
||||||
fs.Write(FSource[1],length(FSource));
|
fs.Write(FSource[1],length(FSource));
|
||||||
@ -481,7 +484,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
tctStrings:
|
tctStrings:
|
||||||
if FStrings<>nil then begin
|
if FStrings<>nil then begin
|
||||||
FStrings.SaveToFile(UTF8ToSys(FFilename));
|
if FStrings is TStringListUTF8 then
|
||||||
|
FStrings.LoadFromFile(FFilename)
|
||||||
|
else
|
||||||
|
FStrings.LoadFromFile(UTF8ToSys(FFilename));
|
||||||
ResetStrings;
|
ResetStrings;
|
||||||
end;
|
end;
|
||||||
tctCodeBuffer:
|
tctCodeBuffer:
|
||||||
@ -543,7 +549,7 @@ begin
|
|||||||
RenameFileUTF8(FFilename,TrimmedFilename);
|
RenameFileUTF8(FFilename,TrimmedFilename);
|
||||||
tctSource:
|
tctSource:
|
||||||
begin
|
begin
|
||||||
fs:=TFileStream.Create(UTF8ToSys(TrimmedFilename),fmCreate);
|
fs:=TFileStreamUTF8.Create(TrimmedFilename,fmCreate);
|
||||||
try
|
try
|
||||||
if FSource<>'' then
|
if FSource<>'' then
|
||||||
fs.Write(FSource[1],length(FSource));
|
fs.Write(FSource[1],length(FSource));
|
||||||
@ -553,7 +559,10 @@ begin
|
|||||||
end;
|
end;
|
||||||
tctStrings:
|
tctStrings:
|
||||||
begin
|
begin
|
||||||
fStrings.SaveToFile(UTF8ToSys(TrimmedFilename));
|
if FStrings is TStringListUTF8 then
|
||||||
|
FStrings.SaveToFile(TrimmedFilename)
|
||||||
|
else
|
||||||
|
FStrings.SaveToFile(UTF8ToSys(TrimmedFilename));
|
||||||
ResetStrings;
|
ResetStrings;
|
||||||
end;
|
end;
|
||||||
tctCodeBuffer:
|
tctCodeBuffer:
|
||||||
@ -686,7 +695,7 @@ begin
|
|||||||
case CurrentType of
|
case CurrentType of
|
||||||
tctSource:
|
tctSource:
|
||||||
begin
|
begin
|
||||||
fs:=TFileStream.Create(UTF8ToSys(AFilename),fmOpenRead);
|
fs:=TFileStreamUTF8.Create(AFilename,fmOpenRead);
|
||||||
try
|
try
|
||||||
SetLength(FSource,fs.Size);
|
SetLength(FSource,fs.Size);
|
||||||
if fSource<>'' then
|
if fSource<>'' then
|
||||||
@ -698,7 +707,10 @@ begin
|
|||||||
tctFile:
|
tctFile:
|
||||||
CopyFile(AFilename,FFilename);
|
CopyFile(AFilename,FFilename);
|
||||||
tctStrings:
|
tctStrings:
|
||||||
FStrings.LoadFromFile(UTF8ToSys(AFilename));
|
if FStrings is TStringListUTF8 then
|
||||||
|
FStrings.LoadFromFile(FFilename)
|
||||||
|
else
|
||||||
|
FStrings.LoadFromFile(UTF8ToSys(FFilename));
|
||||||
end;
|
end;
|
||||||
Result:=true;
|
Result:=true;
|
||||||
except
|
except
|
||||||
|
Loading…
Reference in New Issue
Block a user