Converter: Treat also Wintypes and Winproc units as Windows specific when converting for multi-platform. Issue #22677

git-svn-id: trunk@38343 -
This commit is contained in:
juha 2012-08-23 06:21:49 +00:00
parent 1223b09763
commit 11a9424522
2 changed files with 20 additions and 6 deletions

View File

@ -168,6 +168,9 @@ type
var
ConvertSettingsForm: TConvertSettingsForm;
function IsWinSpecificUnit(const ALowercaseUnitName: string): Boolean;
implementation
@ -333,6 +336,16 @@ begin
end;
end;
function IsWinSpecificUnit(const ALowercaseUnitName: string): Boolean;
// These units exist in Windows only.
// They must be treated as missing units when converting for multi-platform.
begin
Result := (ALowercaseUnitName = 'windows')
or (ALowercaseUnitName = 'shellapi')
or (ALowercaseUnitName = 'wintypes')
or (ALowercaseUnitName = 'winproc') ;
end;
{ TConvertSettings }
constructor TConvertSettings.Create(const ATitle: string);

View File

@ -238,15 +238,16 @@ begin
IDEMessagesWindow.AddMsg(Format(lisConvDelphiFixedUnitCase,
[OldUnitName, NewUnitName]), '', -1);
end;
// Report Windows specific units as missing if target is MultiPlatform,
// needed if work-platform is Windows (kind of a hack). 'variants' ?
if Settings.MultiPlatform and ((LowNU='windows') or (LowNU='shellapi')) then
// Report Windows specific units as missing if target is MultiPlatform.
// Needed if work-platform is Windows (kind of a hack).
if Settings.MultiPlatform and IsWinSpecificUnit(LowNU) then
fMissingUnits.Add(s);
end
else begin
// Omit Windows specific units from the list if target is "Windows only",
// needed if work-platform is different from Windows (kind of a hack).
if Settings.MultiPlatform or ((LowNU<>'windows') and (LowNU<>'shellapi')) then
// If the unit is not found, add it to fMissingUnits, but don't add
// Windows specific units if target is "Windows only".
// Needed if work-platform is different from Windows (kind of a hack).
if Settings.MultiPlatform or not IsWinSpecificUnit(LowNU) then
fMissingUnits.Add(s);
end;
if CodeTool.CurPos.Flag=cafComma then begin