mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2025-03-12 21:48:33 +03:00
fix: use os.Executable instead of os.Args[0] to get prog dir
This commit is contained in:
parent
2c4ebe71d9
commit
11a7ac2013
1 changed files with 6 additions and 1 deletions
|
@ -740,6 +740,11 @@ func secureBinaryUnix() error {
|
|||
// If AdGuardHome is running as a service, it should not use the binary's location as a
|
||||
// workDir, thus this function will return false.
|
||||
func execDirAvaliable() bool {
|
||||
binary, err := os.Executable()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
|
||||
// If installed in /usr/bin do not use /usr/bin/data to store files
|
||||
return filepath.Dir(os.Args[0]) != "/usr/bin"
|
||||
return filepath.Dir(binary) != "/usr/bin"
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue