mirror of
https://github.com/mudler/luet.git
synced 2025-07-31 23:05:03 +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:
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func (c *ConfigProtect) Protected(file string) bool {
|
||||
if file[0:1] != "/" {
|
||||
file = "/" + file
|
||||
}
|
||||
_, ans := c.MapProtected[file]
|
||||
return ans
|
||||
}
|
||||
|
||||
func (c *ConfigProtect) GetProtectFiles() []string {
|
||||
func (c *ConfigProtect) GetProtectFiles(withSlash bool) []string {
|
||||
ans := []string{}
|
||||
|
||||
for key, _ := range c.MapProtected {
|
||||
ans = append(ans, key)
|
||||
if withSlash {
|
||||
ans = append(ans, key)
|
||||
} else {
|
||||
ans = append(ans, key[1:])
|
||||
}
|
||||
}
|
||||
return ans
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user