Fix missing fileInfo.Mode() types
This commit is contained in:
+22
-3
@@ -50,11 +50,17 @@ func (f fileInfo) Size() int64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (f fileInfo) Mode() fs.FileMode {
|
func (f fileInfo) Mode() fs.FileMode {
|
||||||
if f.IsDir() {
|
switch f.fileType {
|
||||||
|
case inode.Dir, inode.EDir:
|
||||||
return fs.FileMode(f.perm | uint32(fs.ModeDir))
|
return fs.FileMode(f.perm | uint32(fs.ModeDir))
|
||||||
}
|
case inode.Sym, inode.ESym:
|
||||||
if f.IsSymlink() {
|
|
||||||
return fs.FileMode(f.perm | uint32(fs.ModeSymlink))
|
return fs.FileMode(f.perm | uint32(fs.ModeSymlink))
|
||||||
|
case inode.Char, inode.EChar, inode.Block, inode.EBlock:
|
||||||
|
return fs.FileMode(f.perm | uint32(fs.ModeDevice))
|
||||||
|
case inode.Fifo, inode.EFifo:
|
||||||
|
return fs.FileMode(f.perm | uint32(fs.ModeNamedPipe))
|
||||||
|
case inode.Sock, inode.ESock:
|
||||||
|
return fs.FileMode(f.perm | uint32(fs.ModeSocket))
|
||||||
}
|
}
|
||||||
return fs.FileMode(f.perm)
|
return fs.FileMode(f.perm)
|
||||||
}
|
}
|
||||||
@@ -71,6 +77,19 @@ func (f fileInfo) IsSymlink() bool {
|
|||||||
return f.fileType == inode.Sym || f.fileType == inode.ESym
|
return f.fileType == inode.Sym || f.fileType == inode.ESym
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (f fileInfo) IsDevice() bool {
|
||||||
|
return f.fileType == inode.Block || f.fileType == inode.EBlock ||
|
||||||
|
f.fileType == inode.Char || f.fileType == inode.EChar
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f fileInfo) IsFifo() bool {
|
||||||
|
return f.fileType == inode.Fifo || f.fileType == inode.EFifo
|
||||||
|
}
|
||||||
|
|
||||||
|
func (f fileInfo) IsSocket() bool {
|
||||||
|
return f.fileType == inode.Sock || f.fileType == inode.ESock
|
||||||
|
}
|
||||||
|
|
||||||
func (f fileInfo) Sys() any {
|
func (f fileInfo) Sys() any {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user