mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-06 05:38:25 +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 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;
|
||||
|
||||
// misc
|
||||
@ -268,6 +269,24 @@ begin
|
||||
LazFileCache.LUIncreaseChangeStamp64(ChangeStamp);
|
||||
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;
|
||||
var
|
||||
Used: array of boolean;
|
||||
|
@ -14,7 +14,7 @@ uses
|
||||
// LazUtils
|
||||
LazFileCache, LazConfigStorage, LazFileUtils, FileUtil,
|
||||
// Codetools
|
||||
DefineTemplates,
|
||||
DefineTemplates, FileProcs,
|
||||
// IdeIntf
|
||||
MacroIntf, BaseIDEIntf;
|
||||
|
||||
@ -158,15 +158,15 @@ begin
|
||||
exit(false);
|
||||
end;
|
||||
if not FileExistsCached(Filename) then begin
|
||||
Msg:=SafeFormat(pjsdFileNotFound, [Filename]);
|
||||
Msg:=CTSafeFormat(pjsdFileNotFound, [Filename]);
|
||||
exit(false);
|
||||
end;
|
||||
if not DirPathExistsCached(ExtractFilePath(Filename)) then begin
|
||||
Msg:=SafeFormat(pjsdDirectoryNotFound, [ExtractFilePath(Filename)]);
|
||||
Msg:=CTSafeFormat(pjsdDirectoryNotFound, [ExtractFilePath(Filename)]);
|
||||
exit(false);
|
||||
end;
|
||||
if not FileIsExecutable(Filename) then begin
|
||||
Msg:=SafeFormat(pjsdFileNotExecutable, [Filename]);
|
||||
Msg:=CTSafeFormat(pjsdFileNotExecutable, [Filename]);
|
||||
exit(false);
|
||||
end;
|
||||
ShortFile:=ExtractFileNameOnly(Filename);
|
||||
|
@ -18,7 +18,8 @@ uses
|
||||
// IdeIntf
|
||||
IDEOptionsIntf, IDEOptEditorIntf, IDEUtils, IDEDialogs,
|
||||
// Pas2Js
|
||||
PJSDsgnOptions, strpas2jsdesign, PJSController, SimpleWebSrvOptionsFrame;
|
||||
PJSDsgnOptions, strpas2jsdesign, PJSController, SimpleWebSrvOptionsFrame,
|
||||
FileProcs;
|
||||
|
||||
Type
|
||||
{ TPas2jsOptionsFrame }
|
||||
@ -204,7 +205,7 @@ begin
|
||||
FDialog := ADialog;
|
||||
|
||||
DefPas2jsExe:=GetStandardPas2jsExe;
|
||||
Pas2jsPathLabel.Caption:=SafeFormat(pjsdPathOfXMacroPas2js, ['pas2js'+GetExeExt]);
|
||||
Pas2jsPathLabel.Caption:=CTSafeFormat(pjsdPathOfXMacroPas2js, ['pas2js'+GetExeExt]);
|
||||
Pas2jsPathLabel.Hint:=Format(
|
||||
pjsdYouCanUseIDEMacrosLikeMakeExeWithoutAFullPathIsSea, [DefPas2jsExe]);
|
||||
Pas2jsPathBrowseButton.Hint:=pjsdBrowse;
|
||||
|
@ -128,27 +128,7 @@ Resourcestring
|
||||
pjsRefreshAllClassesFromHTML = 'Refresh all classes from HTML source';
|
||||
rsHTTPRequestFailed = 'HTML request to service URL %s failed: %s';
|
||||
|
||||
function SafeFormat(const Fmt: String; const Args: Array of const): String;
|
||||
|
||||
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.
|
||||
|
||||
|
@ -134,8 +134,6 @@ function GetValueFromPrimaryConfig(OptionFilename, Path: string): string;
|
||||
function GetValueFromSecondaryConfig(OptionFilename, Path: string): string;
|
||||
function GetValueFromIDEConfig(OptionFilename, Path: string): string;
|
||||
|
||||
function SafeFormat(const Fmt: String; const Args: Array of const): String;
|
||||
|
||||
implementation
|
||||
|
||||
function CheckLazarusDirectoryQuality(ADirectory: string;
|
||||
@ -389,7 +387,7 @@ begin
|
||||
i:=CfgCache.IndexOfUsedCfgFile;
|
||||
if i<0 then
|
||||
begin
|
||||
Note:=SafeFormat(lisCompilerCfgIsMissing,['fpc.cfg']);
|
||||
Note:=CTSafeFormat(lisCompilerCfgIsMissing,['fpc.cfg']);
|
||||
exit;
|
||||
end;
|
||||
if not CfgCache.HasPPUs then
|
||||
@ -649,7 +647,7 @@ begin
|
||||
i:=CfgCache.IndexOfUsedCfgFile;
|
||||
if i<0 then
|
||||
begin
|
||||
Note:=SafeFormat(lisCompilerCfgIsMissing,['pas2js.cfg']);
|
||||
Note:=CTSafeFormat(lisCompilerCfgIsMissing,['pas2js.cfg']);
|
||||
exit;
|
||||
end;
|
||||
//if not CheckPas('classes') then exit;
|
||||
@ -1072,24 +1070,6 @@ begin
|
||||
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 }
|
||||
|
||||
function TSDFileInfoList.AddNewItem(aFilename, aCaption: string): TSDFileInfo;
|
||||
|
Loading…
Reference in New Issue
Block a user