* Adapt paths for Xcode versions 4.3 and above

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2625 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
loesje_
2013-01-15 21:31:26 +00:00
parent 72825b82d6
commit 71003d8a0c
3 changed files with 34 additions and 26 deletions

View File

@@ -452,6 +452,7 @@ begin
try
//ProjectBuilding(nil);
path:=IncludeTrailingPathDelimiter(EnvOptions.SimBundle)+'Contents/MacOS/iPhone Simulator';
EnvOptions.SubstituteMacros(path);
t.CommandLine:='"'+path+'"';
t.CurrentDirectory:=UTF8Encode(GetSandBoxDir(ProjOptions.SpaceName));
t.Execute;

View File

@@ -38,9 +38,7 @@ type
MainNib : WideString;
end;
function GetUserHomeDir: WideString;
function GetiPhoneSimUserPath(const UserHomeDir: WideString=''): WideString;
function GetiPhoneSimUserPath: WideString;
procedure MakeSimSpaceStruct(const BundleName: WideString; var BundleAppDir: WideString);
procedure MakeSimSpaceStruct(const iPhoneSimUserPath, BundleName: WideString; var BundleAppDir: WideString);
@@ -62,6 +60,10 @@ function RandomSpaceName: WideString;
implementation
uses
FileUtil,
iPhoneExtOptions;
function RandomSpaceName: WideString;
var
g : TGUID;
@@ -114,7 +116,12 @@ begin
space8:=UTF8Encode(SpaceName);
p:=IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(path8)+space8);
Result:=UTF8Decode(p);
if DirectoryExistsUTF8(p) then
Result:=UTF8Decode(p)
else if DirectoryExistsUTF8(path8) then
result:=path8
else
result :='';
end;
procedure CreateBundle(const BundleName, ExeName: WideString; const Info: TiPhoneBundleInfo; var FullBundlePath, FullExeName: WideString);
@@ -132,21 +139,13 @@ begin
Result:=w+PathDelim;
end;
function GetUserHomeDir: WideString;
begin
Result:=UTF8Decode(GetUserDir);
end;
function GetiPhoneSimUserPath(const UserHomeDir: WideString=''): WideString;
function GetiPhoneSimUserPath: WideString;
var
nm : WideString;
s : String;
begin
if UserHomeDir = '' then nm:=GetUserHomeDir
else nm:=UserHomeDir;
if nm='' then Exit;
if nm[length(nm)]<>'/' then nm:=nm+'/';
Result:=nm+'Library/Application Support/iPhone Simulator/User/Applications/';
s := EnvOptions.SimAppsPath;
EnvOptions.SubstituteMacros(s);
result := s;
end;
{

View File

@@ -20,8 +20,8 @@ unit iPhoneExtOptions;
interface
uses
Classes, SysUtils, IDEOptionsIntf, LazIDEIntf, ProjectIntf,
iPhoneBundle, DOM, XMLRead, XMLConf, XcodeUtils;
Classes, SysUtils, IDEOptionsIntf, LazIDEIntf, ProjectIntf, MacroIntf,
iPhoneBundle, DOM, XMLRead, XMLConf, XcodeUtils, FileUtil;
const
DefaultResourceDir = 'Resources';
@@ -95,6 +95,8 @@ type
function GetSDKName(const SDKVer: String; simulator: Boolean): String;
function GetSDKFullPath(const SDKVer: String; simulator: Boolean): String;
function SubstituteMacros(var s: string): boolean;
procedure GetSDKVersions(Strings: TStrings);
procedure RefreshVersions;
@@ -213,22 +215,21 @@ end;
function GetDefaultPlatformPath: WideString;
begin
//todo:
Result:='/Developer/Platforms';
result := '/Applications/Xcode.app/Contents/Developer/Platforms';
if not DirectoryExistsUTF8(result) then
Result:='/Developer/Platforms';
end;
function GetDefaultSimBundlePath: WideString;
begin
//todo:
Result:=IncludeTrailingPathDelimiter(GetDefaultPlatformPath)+
Result:='$(iOSPlatformsPath)' +
'iPhoneSimulator.platform/Developer/Applications/iPhone Simulator.app';
end;
function GetDefaultSimAppPath: WideSTring;
begin
//todo:
Result:=IncludeTrailingPathDelimiter(GetUserDir)+
'Library/Applications Support/iPhone Simulator/User/Applications/';
Result:='$(home)'+
'Library/Application Support/iPhone Simulator/$(iOSSDK)/Applications/';
end;
constructor TiPhoneEnvironmentOptions.Create;
@@ -328,6 +329,13 @@ begin
end;
end;
function TiPhoneEnvironmentOptions.SubstituteMacros(var s: string): boolean;
begin
s := StringReplace(s, '$(iOSPlatformsPath)', IncludeTrailingPathDelimiter(PlatformsBaseDir), [rfReplaceAll, rfIgnoreCase]);
s := StringReplace(s, '$(iOSSDK)', DefaultSDK, [rfReplaceAll, rfIgnoreCase]);
result := IDEMacros.SubstituteMacros(s);
end;
procedure TiPhoneEnvironmentOptions.GetSDKVersions(Strings: TStrings);
var
i : Integer;