Working on wildcards before next release.
This commit is contained in:
@@ -150,9 +150,17 @@ func (f *File) GetFileAtPath(path string) *File {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
outer:
|
||||||
for _, child := range children {
|
for _, child := range children {
|
||||||
if strings.Contains(split[0], "*") {
|
if strings.Contains(split[0], "*") {
|
||||||
//TODO: wildcards
|
wilds := strings.Split(split[0], "*")
|
||||||
|
curIndex := 0
|
||||||
|
for i, section := range wilds {
|
||||||
|
ind := strings.Index(child.Name, section)
|
||||||
|
if ind == -1 {
|
||||||
|
continue outer
|
||||||
|
}
|
||||||
|
}
|
||||||
} else if child.Name == split[0] {
|
} else if child.Name == split[0] {
|
||||||
return child.GetFileAtPath(strings.Join(split[1:], "/"))
|
return child.GetFileAtPath(strings.Join(split[1:], "/"))
|
||||||
}
|
}
|
||||||
@@ -336,7 +344,7 @@ func (f *File) ExtractWithOptions(path string, unbreakSymlink bool, folderPerm o
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
f.Close()
|
f.Close()
|
||||||
err = fil.Chown(int(f.r.idTable[f.in.Header.UID]), int(f.r.idTable[f.in.Header.GID]))
|
fil.Chown(int(f.r.idTable[f.in.Header.UID]), int(f.r.idTable[f.in.Header.GID]))
|
||||||
//don't mention anything when it fails. Because it fails often. Probably has something to do about uid & gid 0
|
//don't mention anything when it fails. Because it fails often. Probably has something to do about uid & gid 0
|
||||||
// if err != nil {
|
// if err != nil {
|
||||||
// if verbose {
|
// if verbose {
|
||||||
@@ -370,7 +378,7 @@ func (f *File) ExtractWithOptions(path string, unbreakSymlink bool, folderPerm o
|
|||||||
}
|
}
|
||||||
errs = append(errs, extracSymErrs...)
|
errs = append(errs, extracSymErrs...)
|
||||||
}
|
}
|
||||||
} else {
|
} else if verbose {
|
||||||
fmt.Println("Symlink path(", symPath, ") is outside the archive:"+path+"/"+f.Name)
|
fmt.Println("Symlink path(", symPath, ") is outside the archive:"+path+"/"+f.Name)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -416,7 +424,7 @@ func (f *File) Read(p []byte) (int, error) {
|
|||||||
return f.Reader.Read(p)
|
return f.Reader.Read(p)
|
||||||
}
|
}
|
||||||
|
|
||||||
//ReadDirFromInode returns a fully populated directory.Directory from a given inode.Inode.
|
//ReadDirFromInode returns a fully populated Directory from a given Inode.
|
||||||
//If the given inode is not a directory it returns an error.
|
//If the given inode is not a directory it returns an error.
|
||||||
func (r *Reader) readDirFromInode(i *inode.Inode) (*directory.Directory, error) {
|
func (r *Reader) readDirFromInode(i *inode.Inode) (*directory.Directory, error) {
|
||||||
var offset uint32
|
var offset uint32
|
||||||
|
|||||||
+1
-1
@@ -70,7 +70,7 @@ func (br *metadataReader) parseMetadata() error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
br.offset += 2
|
br.offset += 2
|
||||||
compressed := !(raw&0x8000 == 0x8000)
|
compressed := raw&0x8000 != 0x8000
|
||||||
size := raw &^ 0x8000
|
size := raw &^ 0x8000
|
||||||
br.headers = append(br.headers, &metadata{
|
br.headers = append(br.headers, &metadata{
|
||||||
raw: raw,
|
raw: raw,
|
||||||
|
|||||||
Reference in New Issue
Block a user