Starting work on ExtractTo from File

When using ExtractTo, will automatically set the correct permissions
Will also be able to extract folders
This commit is contained in:
Caleb Gardner
2020-11-29 15:55:06 -06:00
parent c5f1962e72
commit 508a33b323
2 changed files with 52 additions and 0 deletions
+15
View File
@@ -3,6 +3,7 @@ package squashfs
import (
"errors"
"io"
"os"
"strings"
"github.com/CalebQ42/squashfs/internal/directory"
@@ -173,6 +174,20 @@ func (f *File) GetSymlinkFile() *File {
return f.r.GetFileAtPath(f.SymlinkPath())
}
//Permission returns the os.FileMode of the File. Currently only has the permission bits (the last 9) populated.
func (f *File) Permission() os.FileMode {
//TODO: possibly populate more os.FileMode bits
return os.FileMode(f.in.Header.Permissions)
}
func (f *File) ExtractTo(path string) error {
if f.IsDir() {
//TODO
} else if f.IsSymlink() {
}
}
//Close frees up the memory held up by the underlying reader. Should NOT be called when writing.
//When reading, Close is safe to use, but any subsequent Read calls resets to the beginning of the file.
func (f *File) Close() error {