mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-12 02:16:14 +02:00
IDE: moved CTSafeFormat to avoid nameclash with fpc 3.3.1 SafeFormat
This commit is contained in:
parent
05fcd3d0cf
commit
54d8f2bdb1
@ -144,6 +144,7 @@ function CfgStrToDate(const s: string; out Date: TDateTime; const aFormat: strin
|
|||||||
|
|
||||||
procedure CTIncreaseChangeStamp(var ChangeStamp: integer); inline;
|
procedure CTIncreaseChangeStamp(var ChangeStamp: integer); inline;
|
||||||
procedure CTIncreaseChangeStamp64(var ChangeStamp: int64); inline;
|
procedure CTIncreaseChangeStamp64(var ChangeStamp: int64); inline;
|
||||||
|
function CTSafeFormat(const Fmt: String; const Args: Array of const): String; // on exception use SimpleFormat
|
||||||
function SimpleFormat(const Fmt: String; const Args: Array of const): String;
|
function SimpleFormat(const Fmt: String; const Args: Array of const): String;
|
||||||
|
|
||||||
// misc
|
// misc
|
||||||
@ -268,6 +269,24 @@ begin
|
|||||||
LazFileCache.LUIncreaseChangeStamp64(ChangeStamp);
|
LazFileCache.LUIncreaseChangeStamp64(ChangeStamp);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function CTSafeFormat(const Fmt: String; const Args: array of const): String;
|
||||||
|
begin
|
||||||
|
// try with translated resourcestring
|
||||||
|
try
|
||||||
|
Result:=Format(Fmt,Args);
|
||||||
|
exit;
|
||||||
|
except
|
||||||
|
on E: Exception do
|
||||||
|
debugln(['ERROR: SafeFormat: ',E.Message]);
|
||||||
|
end;
|
||||||
|
// translation didn't work
|
||||||
|
// ToDo: find out how to get the resourcestring default value
|
||||||
|
//ResetResourceTables;
|
||||||
|
|
||||||
|
// use a safe fallback
|
||||||
|
Result:=SimpleFormat(Fmt,Args);
|
||||||
|
end;
|
||||||
|
|
||||||
function SimpleFormat(const Fmt: String; const Args: array of const): String;
|
function SimpleFormat(const Fmt: String; const Args: array of const): String;
|
||||||
var
|
var
|
||||||
Used: array of boolean;
|
Used: array of boolean;
|
||||||
|
@ -14,7 +14,7 @@ uses
|
|||||||
// LazUtils
|
// LazUtils
|
||||||
LazFileCache, LazConfigStorage, LazFileUtils, FileUtil,
|
LazFileCache, LazConfigStorage, LazFileUtils, FileUtil,
|
||||||
// Codetools
|
// Codetools
|
||||||
DefineTemplates,
|
DefineTemplates, FileProcs,
|
||||||
// IdeIntf
|
// IdeIntf
|
||||||
MacroIntf, BaseIDEIntf;
|
MacroIntf, BaseIDEIntf;
|
||||||
|
|
||||||
@ -158,15 +158,15 @@ begin
|
|||||||
exit(false);
|
exit(false);
|
||||||
end;
|
end;
|
||||||
if not FileExistsCached(Filename) then begin
|
if not FileExistsCached(Filename) then begin
|
||||||
Msg:=SafeFormat(pjsdFileNotFound, [Filename]);
|
Msg:=CTSafeFormat(pjsdFileNotFound, [Filename]);
|
||||||
exit(false);
|
exit(false);
|
||||||
end;
|
end;
|
||||||
if not DirPathExistsCached(ExtractFilePath(Filename)) then begin
|
if not DirPathExistsCached(ExtractFilePath(Filename)) then begin
|
||||||
Msg:=SafeFormat(pjsdDirectoryNotFound, [ExtractFilePath(Filename)]);
|
Msg:=CTSafeFormat(pjsdDirectoryNotFound, [ExtractFilePath(Filename)]);
|
||||||
exit(false);
|
exit(false);
|
||||||
end;
|
end;
|
||||||
if not FileIsExecutable(Filename) then begin
|
if not FileIsExecutable(Filename) then begin
|
||||||
Msg:=SafeFormat(pjsdFileNotExecutable, [Filename]);
|
Msg:=CTSafeFormat(pjsdFileNotExecutable, [Filename]);
|
||||||
exit(false);
|
exit(false);
|
||||||
end;
|
end;
|
||||||
ShortFile:=ExtractFileNameOnly(Filename);
|
ShortFile:=ExtractFileNameOnly(Filename);
|
||||||
|
@ -18,7 +18,8 @@ uses
|
|||||||
// IdeIntf
|
// IdeIntf
|
||||||
IDEOptionsIntf, IDEOptEditorIntf, IDEUtils, IDEDialogs,
|
IDEOptionsIntf, IDEOptEditorIntf, IDEUtils, IDEDialogs,
|
||||||
// Pas2Js
|
// Pas2Js
|
||||||
PJSDsgnOptions, strpas2jsdesign, PJSController, SimpleWebSrvOptionsFrame;
|
PJSDsgnOptions, strpas2jsdesign, PJSController, SimpleWebSrvOptionsFrame,
|
||||||
|
FileProcs;
|
||||||
|
|
||||||
Type
|
Type
|
||||||
{ TPas2jsOptionsFrame }
|
{ TPas2jsOptionsFrame }
|
||||||
@ -204,7 +205,7 @@ begin
|
|||||||
FDialog := ADialog;
|
FDialog := ADialog;
|
||||||
|
|
||||||
DefPas2jsExe:=GetStandardPas2jsExe;
|
DefPas2jsExe:=GetStandardPas2jsExe;
|
||||||
Pas2jsPathLabel.Caption:=SafeFormat(pjsdPathOfXMacroPas2js, ['pas2js'+GetExeExt]);
|
Pas2jsPathLabel.Caption:=CTSafeFormat(pjsdPathOfXMacroPas2js, ['pas2js'+GetExeExt]);
|
||||||
Pas2jsPathLabel.Hint:=Format(
|
Pas2jsPathLabel.Hint:=Format(
|
||||||
pjsdYouCanUseIDEMacrosLikeMakeExeWithoutAFullPathIsSea, [DefPas2jsExe]);
|
pjsdYouCanUseIDEMacrosLikeMakeExeWithoutAFullPathIsSea, [DefPas2jsExe]);
|
||||||
Pas2jsPathBrowseButton.Hint:=pjsdBrowse;
|
Pas2jsPathBrowseButton.Hint:=pjsdBrowse;
|
||||||
|
@ -128,27 +128,7 @@ Resourcestring
|
|||||||
pjsRefreshAllClassesFromHTML = 'Refresh all classes from HTML source';
|
pjsRefreshAllClassesFromHTML = 'Refresh all classes from HTML source';
|
||||||
rsHTTPRequestFailed = 'HTML request to service URL %s failed: %s';
|
rsHTTPRequestFailed = 'HTML request to service URL %s failed: %s';
|
||||||
|
|
||||||
function SafeFormat(const Fmt: String; const Args: Array of const): String;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function SafeFormat(const Fmt: String; const Args: array of const): String;
|
|
||||||
begin
|
|
||||||
// try with translated resourcestring
|
|
||||||
try
|
|
||||||
Result:=Format(Fmt,Args);
|
|
||||||
exit;
|
|
||||||
except
|
|
||||||
on E: Exception do
|
|
||||||
debugln(['ERROR: SafeFormat: ',E.Message]);
|
|
||||||
end;
|
|
||||||
// translation didn't work
|
|
||||||
// ToDo: find out how to get the resourcestring default value
|
|
||||||
//ResetResourceTables;
|
|
||||||
|
|
||||||
// use a safe fallback
|
|
||||||
Result:=SimpleFormat(Fmt,Args);
|
|
||||||
end;
|
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
@ -134,8 +134,6 @@ function GetValueFromPrimaryConfig(OptionFilename, Path: string): string;
|
|||||||
function GetValueFromSecondaryConfig(OptionFilename, Path: string): string;
|
function GetValueFromSecondaryConfig(OptionFilename, Path: string): string;
|
||||||
function GetValueFromIDEConfig(OptionFilename, Path: string): string;
|
function GetValueFromIDEConfig(OptionFilename, Path: string): string;
|
||||||
|
|
||||||
function SafeFormat(const Fmt: String; const Args: Array of const): String;
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
function CheckLazarusDirectoryQuality(ADirectory: string;
|
function CheckLazarusDirectoryQuality(ADirectory: string;
|
||||||
@ -389,7 +387,7 @@ begin
|
|||||||
i:=CfgCache.IndexOfUsedCfgFile;
|
i:=CfgCache.IndexOfUsedCfgFile;
|
||||||
if i<0 then
|
if i<0 then
|
||||||
begin
|
begin
|
||||||
Note:=SafeFormat(lisCompilerCfgIsMissing,['fpc.cfg']);
|
Note:=CTSafeFormat(lisCompilerCfgIsMissing,['fpc.cfg']);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
if not CfgCache.HasPPUs then
|
if not CfgCache.HasPPUs then
|
||||||
@ -649,7 +647,7 @@ begin
|
|||||||
i:=CfgCache.IndexOfUsedCfgFile;
|
i:=CfgCache.IndexOfUsedCfgFile;
|
||||||
if i<0 then
|
if i<0 then
|
||||||
begin
|
begin
|
||||||
Note:=SafeFormat(lisCompilerCfgIsMissing,['pas2js.cfg']);
|
Note:=CTSafeFormat(lisCompilerCfgIsMissing,['pas2js.cfg']);
|
||||||
exit;
|
exit;
|
||||||
end;
|
end;
|
||||||
//if not CheckPas('classes') then exit;
|
//if not CheckPas('classes') then exit;
|
||||||
@ -1072,24 +1070,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function SafeFormat(const Fmt: String; const Args: array of const): String;
|
|
||||||
begin
|
|
||||||
// try with translated resourcestring
|
|
||||||
try
|
|
||||||
Result:=Format(Fmt,Args);
|
|
||||||
exit;
|
|
||||||
except
|
|
||||||
on E: Exception do
|
|
||||||
debugln(['ERROR: SafeFormat: ',E.Message]);
|
|
||||||
end;
|
|
||||||
// translation didn't work
|
|
||||||
// ToDo: find out how to get the resourcestring default value
|
|
||||||
//ResetResourceTables;
|
|
||||||
|
|
||||||
// use a safe fallback
|
|
||||||
Result:=SimpleFormat(Fmt,Args);
|
|
||||||
end;
|
|
||||||
|
|
||||||
{ TSDFileInfoList }
|
{ TSDFileInfoList }
|
||||||
|
|
||||||
function TSDFileInfoList.AddNewItem(aFilename, aCaption: string): TSDFileInfo;
|
function TSDFileInfoList.AddNewItem(aFilename, aCaption: string): TSDFileInfo;
|
||||||
|
Loading…
Reference in New Issue
Block a user