You've already forked lazarus-ccr
iphonelazext: added support for iphone resouce files (sim only)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1147 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -41,9 +41,11 @@ type
|
||||
procedure FillBunldeInfo(forSimulator: Boolean; var info: TiPhoneBundleInfo);
|
||||
procedure InstallAppToSim;
|
||||
function FixCustomOptions(const Options: String; isRealDevice: Boolean): String;
|
||||
|
||||
function WriteIconTo(const FullName: String): Boolean;
|
||||
|
||||
function ProjectBuilding(Sender: TObject): TModalResult;
|
||||
function ProjectOpened(Sender: TObject; AProject: TLazProject): TModalResult;
|
||||
function WriteIconTo(const FullName: String): Boolean;
|
||||
procedure OnProjOptionsChanged(Sender: TObject);
|
||||
public
|
||||
isiPhoneMenu :TIDEMenuCommand;
|
||||
@ -119,6 +121,12 @@ begin
|
||||
|
||||
WriteIconTo( IncludeTrailingPathDelimiter(bundlepath)+'Icon.png');
|
||||
|
||||
CopySymLinks(
|
||||
ResolveProjectPath(ProjOptions.ResourceDir),
|
||||
bundlepath,
|
||||
ProjOptions.ExcludeMask
|
||||
);
|
||||
|
||||
if nm<>'' then begin
|
||||
symlink:=UTF8Encode(exepath);
|
||||
FpUnlink(symlink);
|
||||
@ -426,8 +434,10 @@ var
|
||||
begin
|
||||
t :=TProcess.Create(nil);
|
||||
try
|
||||
//ProjectBuilding(nil);
|
||||
path:=IncludeTrailingPathDelimiter(EnvOptions.SimBundle)+'Contents/MacOS/iPhone Simulator';
|
||||
t.CommandLine:='"'+path+'"';
|
||||
t.CurrentDirectory:=UTF8Encode(GetSandBoxDir(ProjOptions.SpaceName));
|
||||
t.Execute;
|
||||
except
|
||||
on E: Exception do
|
||||
|
@ -52,6 +52,8 @@ function WriteDefInfoList(const InfoFileName, BundleName, ExeName: WideString; c
|
||||
|
||||
procedure CreateBundle(const BundleName, ExeName: WideString; const Info: TiPhoneBundleInfo; var FullBundlePath, FullExeName: WideString);
|
||||
procedure CreateBundle(const BundleName, SpaceName, ExeName: WideString; const Info: TiPhoneBundleInfo; var RealSpace, FullBundlePath, FullExeName: WideString);
|
||||
function GetBundleFullDir(const BundleName, SpaceName: WideString): WideString;
|
||||
function GetSandBoxDir(const SpaceName: WideString): WideString;
|
||||
|
||||
function AddPathDelim(const w: WideString): WideString;
|
||||
|
||||
@ -88,6 +90,32 @@ begin
|
||||
WriteDefInfoList(appdir+'Info.plist', BundleName, ExeName, Info);
|
||||
end;
|
||||
|
||||
function GetBundleFullDir(const BundleName, SpaceName: WideString): WideString;
|
||||
var
|
||||
path8 : String;
|
||||
space8 : String;
|
||||
p : string;
|
||||
begin
|
||||
path8:=UTF8Encode(GetiPhoneSimUserPath);
|
||||
space8:=UTF8Encode(SpaceName);
|
||||
|
||||
p:=IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(path8)+space8);
|
||||
Result:=UTF8Decode(p+UTF8Encode(BundleName)+'.app');
|
||||
end;
|
||||
|
||||
function GetSandBoxDir(const SpaceName: WideString): WideString;
|
||||
var
|
||||
path8 : String;
|
||||
space8 : String;
|
||||
p : string;
|
||||
begin
|
||||
path8:=UTF8Encode(GetiPhoneSimUserPath);
|
||||
space8:=UTF8Encode(SpaceName);
|
||||
|
||||
p:=IncludeTrailingPathDelimiter(IncludeTrailingPathDelimiter(path8)+space8);
|
||||
Result:=UTF8Decode(p);
|
||||
end;
|
||||
|
||||
procedure CreateBundle(const BundleName, ExeName: WideString; const Info: TiPhoneBundleInfo; var FullBundlePath, FullExeName: WideString);
|
||||
var
|
||||
sp : WideString;
|
||||
|
@ -33,6 +33,8 @@ type
|
||||
fSDK : string;
|
||||
DataWritten : Boolean;
|
||||
fSpaceName : string;
|
||||
fResourceDir : string;
|
||||
fExcludeMask : string;
|
||||
public
|
||||
constructor Create;
|
||||
class function GetGroupCaption: string; override;
|
||||
@ -44,6 +46,8 @@ type
|
||||
property SDK: string read fSDK write fSDK;
|
||||
property AppID: string read fAppID write fAppID;
|
||||
property SpaceName: string read fSpaceName write fSpaceName;
|
||||
property ResourceDir: string read fResourceDir write fResourceDir;
|
||||
property ExcludeMask: string read fExcludeMask write fExcludeMask;
|
||||
end;
|
||||
|
||||
{ TiPhoneEnvironmentOptions }
|
||||
@ -126,7 +130,8 @@ const
|
||||
optSDK = 'iPhone/SDK';
|
||||
optAppID = 'iPhone/AppID';
|
||||
optSpaceName = 'iPhone/SimSpaceName';
|
||||
|
||||
optResourceDir = 'iPhone/ResourceDir';
|
||||
optExcludeMask = 'iPhone/ExcludeMask';
|
||||
|
||||
function EnvOptions: TiPhoneEnvironmentOptions;
|
||||
begin
|
||||
@ -373,6 +378,8 @@ begin
|
||||
if CustomData.Contains(optAppID) then fAppID:=CustomData.Values[optAppID];
|
||||
fSpaceName:=CustomData.Values[optSpaceName];
|
||||
if fSpaceName='' then fSpaceName:=RandomSpaceName;
|
||||
if CustomData.Contains(optResourceDir) then fResourceDir:=CustomData.Values[optResourceDir];
|
||||
if CustomData.Contains(optExcludeMask) then fExcludeMask:=CustomData.Values[optExcludeMask];
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -388,6 +395,8 @@ begin
|
||||
CustomData.Values[optSDK]:=fSDK;
|
||||
CustomData.Values[optAppID]:=fAppID;
|
||||
CustomData.Values[optSpaceName]:=fSpaceName;
|
||||
CustomData.Values[optResourceDir]:=fResourceDir;
|
||||
CustomData.Values[optExcludeMask]:=fExcludeMask;
|
||||
end;
|
||||
end;
|
||||
|
||||
@ -452,7 +461,6 @@ var
|
||||
end;
|
||||
|
||||
begin
|
||||
writeln('scan for SDK');
|
||||
Result:=Assigned(FoundProc);
|
||||
if not Result then Exit;
|
||||
|
||||
|
@ -19,7 +19,8 @@ unit lazfilesutils;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil,
|
||||
{$ifdef Unix}BaseUnix,{$endif}
|
||||
Classes, SysUtils, FileUtil, Masks,
|
||||
LazIDEIntf,ProjectIntf;
|
||||
|
||||
|
||||
@ -30,8 +31,53 @@ function BreakPathsStringToOption(const Paths, Switch: String; const Quotes: str
|
||||
function RelativeToFullPath(const BasePath, Relative: string): String;
|
||||
function NeedQuotes(const path: string): Boolean;
|
||||
|
||||
function CopySymLinks(const SrcDir, DstDir, FilterMask: string): Boolean;
|
||||
|
||||
implementation
|
||||
|
||||
{$ifdef Unix}
|
||||
function CopySymLinks(const SrcDir, DstDir, FilterMask: string): Boolean;
|
||||
var
|
||||
allfiles : TStringList;
|
||||
i : Integer;
|
||||
pth : string;
|
||||
MaskList : TMaskList;
|
||||
curdir : string;
|
||||
linkdir : string;
|
||||
linkname : string;
|
||||
begin
|
||||
Result:=DirectoryExistsUTF8(SrcDir) and ForceDirectoriesUTF8(DstDir);
|
||||
if not Result then Exit;
|
||||
|
||||
//todo: don't use FindAllFiles(), use sub dir search
|
||||
|
||||
allfiles:=FindAllFiles(SrcDir, AllFilesMask, False);
|
||||
Result:=Assigned(allfiles);
|
||||
if not Result then Exit;
|
||||
|
||||
MaskList := TMaskList.Create(FilterMask);
|
||||
|
||||
curdir:=IncludeTrailingPathDelimiter(SrcDir);
|
||||
linkdir:=IncludeTrailingPathDelimiter(DstDir);
|
||||
for i:=0 to allfiles.Count-1 do begin
|
||||
pth:=allfiles[i];
|
||||
if (FilterMask='') or (not MaskList.Matches(pth)) then begin
|
||||
linkname:=linkdir+Copy(pth, length(curdir), length(pth));
|
||||
writeln('link from: ', pth);
|
||||
writeln(' to: ', linkname);
|
||||
fpSymlink(PAnsiChar(pth), PAnsiChar(linkname));
|
||||
end;
|
||||
end;
|
||||
allfiles.Free;
|
||||
end;
|
||||
{$else}
|
||||
function CopySymLinks(const SrcDir, DstDir, FilterMask: string): Boolean;
|
||||
begin
|
||||
Result:=false;
|
||||
end;
|
||||
{$endif}
|
||||
|
||||
|
||||
function GetNextDir(const Path: string; var index: integer; var Name: string): Boolean;
|
||||
var
|
||||
i : Integer;
|
||||
|
@ -60,12 +60,49 @@ inherited iPhoneProjectOptionsEditor: TiPhoneProjectOptionsEditor
|
||||
Style = csDropDownList
|
||||
TabOrder = 2
|
||||
end
|
||||
object lblXibFiles: TLabel[6]
|
||||
object edtResDir: TEdit[6]
|
||||
Left = 120
|
||||
Height = 22
|
||||
Top = 176
|
||||
Width = 480
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
TabOrder = 3
|
||||
Text = 'Resources'
|
||||
end
|
||||
object Label1: TLabel[7]
|
||||
Left = 16
|
||||
Height = 18
|
||||
Top = 168
|
||||
Width = 219
|
||||
Caption = '.XIB files might appear here soon...'
|
||||
Top = 176
|
||||
Width = 89
|
||||
Caption = 'Resources dir:'
|
||||
ParentColor = False
|
||||
end
|
||||
object edtExclude: TEdit[8]
|
||||
Left = 120
|
||||
Height = 22
|
||||
Top = 224
|
||||
Width = 480
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
OnChange = edtExcludeChange
|
||||
TabOrder = 4
|
||||
Text = '.svn'
|
||||
end
|
||||
object Label2: TLabel[9]
|
||||
Left = 16
|
||||
Height = 18
|
||||
Top = 224
|
||||
Width = 81
|
||||
Caption = 'Ignore mask:'
|
||||
ParentColor = False
|
||||
end
|
||||
object Label3: TLabel[10]
|
||||
Left = 16
|
||||
Height = 14
|
||||
Top = 200
|
||||
Width = 364
|
||||
Caption = 'It''s recommended to set resource dir as a relative (to project .lpr file) path'
|
||||
Font.Height = -10
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
end
|
||||
|
@ -18,7 +18,17 @@ LazarusResources.Add('TiPhoneProjectOptionsEditor','FORMDATA',[
|
||||
+#2'3'#5'Width'#2'P'#7'Caption'#6#12'SDK version:'#11'ParentColor'#8#0#0#242#2
|
||||
+#5#9'TComboBox'#7'cmbSDKs'#4'Left'#2'p'#6'Height'#2#20#3'Top'#2'0'#5'Width'#3
|
||||
+#184#0#10'ItemHeight'#2#0#8'OnChange'#7#13'cmbSDKsChange'#5'Style'#7#14'csDr'
|
||||
+'opDownList'#8'TabOrder'#2#2#0#0#242#2#6#6'TLabel'#11'lblXibFiles'#4'Left'#2
|
||||
+#16#6'Height'#2#18#3'Top'#3#168#0#5'Width'#3#219#0#7'Caption'#6'$.XIB files '
|
||||
+'might appear here soon...'#11'ParentColor'#8#0#0#0
|
||||
+'opDownList'#8'TabOrder'#2#2#0#0#242#2#6#5'TEdit'#9'edtResDir'#4'Left'#2'x'#6
|
||||
+'Height'#2#22#3'Top'#3#176#0#5'Width'#3#224#1#7'Anchors'#11#5'akTop'#6'akLef'
|
||||
+'t'#7'akRight'#0#8'TabOrder'#2#3#4'Text'#6#9'Resources'#0#0#242#2#7#6'TLabel'
|
||||
+#6'Label1'#4'Left'#2#16#6'Height'#2#18#3'Top'#3#176#0#5'Width'#2'Y'#7'Captio'
|
||||
+'n'#6#14'Resources dir:'#11'ParentColor'#8#0#0#242#2#8#5'TEdit'#10'edtExclud'
|
||||
+'e'#4'Left'#2'x'#6'Height'#2#22#3'Top'#3#224#0#5'Width'#3#224#1#7'Anchors'#11
|
||||
+#5'akTop'#6'akLeft'#7'akRight'#0#8'OnChange'#7#16'edtExcludeChange'#8'TabOrd'
|
||||
+'er'#2#4#4'Text'#6#4'.svn'#0#0#242#2#9#6'TLabel'#6'Label2'#4'Left'#2#16#6'He'
|
||||
+'ight'#2#18#3'Top'#3#224#0#5'Width'#2'Q'#7'Caption'#6#12'Ignore mask:'#11'Pa'
|
||||
+'rentColor'#8#0#0#242#2#10#6'TLabel'#6'Label3'#4'Left'#2#16#6'Height'#2#14#3
|
||||
+'Top'#3#200#0#5'Width'#3'l'#1#7'Caption'#6'NIt''s recommended to set resourc'
|
||||
+'e dir as a relative (to project .lpr file) path'#11'Font.Height'#2#246#11'P'
|
||||
+'arentColor'#8#10'ParentFont'#8#0#0#0
|
||||
]);
|
||||
|
@ -30,12 +30,17 @@ type
|
||||
TiPhoneProjectOptionsEditor = class(TAbstractIDEOptionsEditor)
|
||||
chkisPhone: TCheckBox;
|
||||
cmbSDKs: TComboBox;
|
||||
edtResDir: TEdit;
|
||||
edtExclude: TEdit;
|
||||
edtAppID: TEdit;
|
||||
lblXibFiles: TLabel;
|
||||
Label1: TLabel;
|
||||
Label2: TLabel;
|
||||
Label3: TLabel;
|
||||
lblAppID: TLabel;
|
||||
lblAppIDHint: TLabel;
|
||||
lblSDKVer: TLabel;
|
||||
procedure cmbSDKsChange(Sender: TObject);
|
||||
procedure edtExcludeChange(Sender: TObject);
|
||||
procedure FrameClick(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
@ -60,6 +65,11 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TiPhoneProjectOptionsEditor.edtExcludeChange(Sender: TObject);
|
||||
begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TiPhoneProjectOptionsEditor.FrameClick(Sender: TObject);
|
||||
begin
|
||||
|
||||
@ -99,6 +109,8 @@ begin
|
||||
i:=cmbSDKs.Items.IndexOf(EnvOptions.DefaultSDK);
|
||||
cmbSDKs.ItemIndex:=i;
|
||||
edtAppID.Text:=AppID;
|
||||
edtResDir.Text:=ResourceDir;
|
||||
edtExclude.Text:=ExcludeMask;
|
||||
end;
|
||||
|
||||
end;
|
||||
@ -110,6 +122,8 @@ begin
|
||||
isIPhoneApp:=chkisPhone.Checked;
|
||||
SDK:=cmbSDKs.Caption;
|
||||
AppID:=edtAppID.Text;
|
||||
ResourceDir:=edtResDir.Text;
|
||||
ExcludeMask:=edtExclude.Text;
|
||||
Save;
|
||||
DoChanged;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user