summaryrefslogtreecommitdiffstats
path: root/cmd
diff options
context:
space:
mode:
authorJakob Borg <jakob@nym.se>2014-05-24 22:45:50 +0200
committerJakob Borg <jakob@nym.se>2014-05-24 22:45:50 +0200
commit1cd7cc6869b4994e35e9bd1cb656c58a1cac94c8 (patch)
treea8d84e3c5b628db43d4ba860d1e2847fbcab19ad /cmd
parent9de2864db31e7043b29eca6a15eaacfeb97e4f4f (diff)
Configuration directory is machine local (Windows)
Diffstat (limited to 'cmd')
-rw-r--r--cmd/syncthing/main.go9
1 files changed, 7 insertions, 2 deletions
diff --git a/cmd/syncthing/main.go b/cmd/syncthing/main.go
index 35cc71fc41..1f626fb0c8 100644
--- a/cmd/syncthing/main.go
+++ b/cmd/syncthing/main.go
@@ -130,7 +130,12 @@ func main() {
// continue. We don't much care if this fails at this point, we will
// be checking that later.
- oldDefault := expandTilde("~/.syncthing")
+ var oldDefault string
+ if runtime.GOOS == "windows" {
+ oldDefault = filepath.Join(os.Getenv("AppData"), "Syncthing")
+ } else {
+ oldDefault = expandTilde("~/.syncthing")
+ }
if _, err := os.Stat(oldDefault); err == nil {
os.MkdirAll(filepath.Dir(confDir), 0700)
if err := os.Rename(oldDefault, confDir); err == nil {
@@ -670,7 +675,7 @@ func ensureDir(dir string, mode int) {
func getDefaultConfDir() string {
switch runtime.GOOS {
case "windows":
- return filepath.Join(os.Getenv("AppData"), "Syncthing")
+ return filepath.Join(os.Getenv("LocalAppData"), "Syncthing")
case "darwin":
return expandTilde("~/Library/Application Support/Syncthing")