mirror of
https://github.com/mudler/luet.git
synced 2025-08-08 02:44:43 +00:00
ConfigProtect: Permit to obtain the list of files without initial /
This commit is contained in:
parent
b24d335538
commit
68bc8d4d27
@ -91,18 +91,26 @@ func (c *ConfigProtect) Map(files []string) {
|
|||||||
}
|
}
|
||||||
nextFile:
|
nextFile:
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConfigProtect) Protected(file string) bool {
|
func (c *ConfigProtect) Protected(file string) bool {
|
||||||
|
if file[0:1] != "/" {
|
||||||
|
file = "/" + file
|
||||||
|
}
|
||||||
_, ans := c.MapProtected[file]
|
_, ans := c.MapProtected[file]
|
||||||
return ans
|
return ans
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *ConfigProtect) GetProtectFiles() []string {
|
func (c *ConfigProtect) GetProtectFiles(withSlash bool) []string {
|
||||||
ans := []string{}
|
ans := []string{}
|
||||||
|
|
||||||
for key, _ := range c.MapProtected {
|
for key, _ := range c.MapProtected {
|
||||||
|
if withSlash {
|
||||||
ans = append(ans, key)
|
ans = append(ans, key)
|
||||||
|
} else {
|
||||||
|
ans = append(ans, key[1:])
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return ans
|
return ans
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user