Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6dfcb1cf80 | |||
| c7593eaff3 |
@@ -148,6 +148,15 @@ func NewSquashfsReader(r io.ReaderAt) (*Reader, error) {
|
|||||||
return &rdr, nil
|
return &rdr, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//ExtractTo tries to extract ALL files to the given path. This is the same as getting the root folder and extracting that.
|
||||||
|
func (r *Reader) ExtractTo(path string) []error {
|
||||||
|
root, err := r.GetRootFolder()
|
||||||
|
if err != nil {
|
||||||
|
return []error{err}
|
||||||
|
}
|
||||||
|
return root.ExtractTo(path)
|
||||||
|
}
|
||||||
|
|
||||||
//GetRootFolder returns a squashfs.File that references the root directory of the squashfs archive.
|
//GetRootFolder returns a squashfs.File that references the root directory of the squashfs archive.
|
||||||
func (r *Reader) GetRootFolder() (root *File, err error) {
|
func (r *Reader) GetRootFolder() (root *File, err error) {
|
||||||
root = new(File)
|
root = new(File)
|
||||||
|
|||||||
+1
-5
@@ -58,11 +58,7 @@ func TestAppImage(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
fil := rdr.GetFileAtPath(".DirIcon")
|
errs := rdr.ExtractTo(wd + "/testing/cool-retro")
|
||||||
if fil == nil {
|
|
||||||
t.Fatal("Can't find desktop file")
|
|
||||||
}
|
|
||||||
errs := fil.ExtractSymlink(wd + "/testing/")
|
|
||||||
if len(errs) > 0 {
|
if len(errs) > 0 {
|
||||||
t.Fatal(errs)
|
t.Fatal(errs)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user