* 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 try
//ProjectBuilding(nil); //ProjectBuilding(nil);
path:=IncludeTrailingPathDelimiter(EnvOptions.SimBundle)+'Contents/MacOS/iPhone Simulator'; path:=IncludeTrailingPathDelimiter(EnvOptions.SimBundle)+'Contents/MacOS/iPhone Simulator';
EnvOptions.SubstituteMacros(path);
t.CommandLine:='"'+path+'"'; t.CommandLine:='"'+path+'"';
t.CurrentDirectory:=UTF8Encode(GetSandBoxDir(ProjOptions.SpaceName)); t.CurrentDirectory:=UTF8Encode(GetSandBoxDir(ProjOptions.SpaceName));
t.Execute; t.Execute;

View File

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

View File

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