mirror of
https://github.com/tailscale/tailscale.git
synced 2025-02-22 04:48:39 +00:00
ipn/ipnserver paths: add paths.LegacyStateFilePath
Moving this information into a centralized place so that it is accessible to code in subsequent commits. Updates #3011 Signed-off-by: Aaron Klotz <aaron@tailscale.com>
This commit is contained in:
parent
11fdb14c53
commit
6425f497b1
@ -20,7 +20,6 @@ import (
|
|||||||
"os/exec"
|
"os/exec"
|
||||||
"os/signal"
|
"os/signal"
|
||||||
"os/user"
|
"os/user"
|
||||||
"path/filepath"
|
|
||||||
"runtime"
|
"runtime"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -602,7 +601,7 @@ func tryWindowsAppDataMigration(logf logger.Logf, path string) string {
|
|||||||
// what they are doing.
|
// what they are doing.
|
||||||
return path
|
return path
|
||||||
}
|
}
|
||||||
oldFile := filepath.Join(os.Getenv("LocalAppData"), "Tailscale", "server-state.conf")
|
oldFile := paths.LegacyStateFilePath()
|
||||||
return paths.TryConfigFileMigration(logf, oldFile, path)
|
return paths.TryConfigFileMigration(logf, oldFile, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,3 +81,8 @@ func ensureStateDirPerms(dir string) error {
|
|||||||
}
|
}
|
||||||
return os.Chmod(dir, perm)
|
return os.Chmod(dir, perm)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LegacyStateFilePath is not applicable to UNIX; it is just stubbed out.
|
||||||
|
func LegacyStateFilePath() string {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
@ -148,3 +148,9 @@ func ensureStateDirPerms(dirPath string) error {
|
|||||||
return windows.SetNamedSecurityInfo(dirPath, windows.SE_FILE_OBJECT, flags,
|
return windows.SetNamedSecurityInfo(dirPath, windows.SE_FILE_OBJECT, flags,
|
||||||
sids.User, sids.PrimaryGroup, dacl, nil)
|
sids.User, sids.PrimaryGroup, dacl, nil)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LegacyStateFilePath returns the legacy path to the state file when it was stored under the
|
||||||
|
// current user's %LocalAppData%.
|
||||||
|
func LegacyStateFilePath() string {
|
||||||
|
return filepath.Join(os.Getenv("LocalAppData"), "Tailscale", "server-state.conf")
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user