33 lines
603 B
Go
33 lines
603 B
Go
package action
|
|
|
|
import (
|
|
"io/ioutil"
|
|
|
|
. "ios-wrapper/internal/wrapper/ofile"
|
|
"ios-wrapper/pkg/ios/fat"
|
|
)
|
|
|
|
type writeFile struct {
|
|
outfile string
|
|
}
|
|
|
|
func (action *writeFile) withMacho(mf *MachoFile) error {
|
|
data, _ := ioutil.ReadFile(mf.TmpFile())
|
|
return ioutil.WriteFile(action.outfile, data, 0644)
|
|
}
|
|
|
|
func (action *writeFile) withFat(ff *FatFile) error {
|
|
var files []string
|
|
for _, macho := range ff.Machos() {
|
|
files = append(files, macho.TmpFile())
|
|
}
|
|
fat.FatJoin(files, action.outfile)
|
|
return nil
|
|
}
|
|
|
|
func NewWriteFileAction(outfile string) *writeFile {
|
|
return &writeFile{
|
|
outfile,
|
|
}
|
|
}
|