diff --git a/pkg/ipa/ipa.go b/pkg/ipa/ipa.go index 9bca61c..6370f7c 100644 --- a/pkg/ipa/ipa.go +++ b/pkg/ipa/ipa.go @@ -99,6 +99,11 @@ func (a App) File(name string) *zip.File { return nil } +func (a App) FileBytes(name string) ([]byte, error) { + target := path.Join(a.dir(), name) + return a.p.FileBytes(target) +} + func (a App) Plist() (*Plist, error) { b, err := a.p.FileBytes(path.Join(a.dir(), "Info.plist")) if err != nil { diff --git a/pkg/ipa/ipa_test.go b/pkg/ipa/ipa_test.go index 0e9510b..3a86a8c 100644 --- a/pkg/ipa/ipa_test.go +++ b/pkg/ipa/ipa_test.go @@ -62,4 +62,12 @@ func TestOpen_gomobileipfsdemo(t *testing.T) { UISupportedInterfaceOrientations: []string{"UIInterfaceOrientationPortrait", "UIInterfaceOrientationLandscapeLeft"}, } require.Equal(t, plist, expected) + + noExists, err := app.FileBytes("blahblah") + require.Nil(t, noExists) + require.Error(t, err) + + exists, err := app.FileBytes("Frameworks/libswiftFoundation.dylib") + require.NoError(t, err) + require.Equal(t, len(exists), 8479536) }