From 74fadfb262a8414cf7f0d9e7100354ed7659b6bb Mon Sep 17 00:00:00 2001 From: skilion Date: Sun, 20 Sep 2015 14:20:01 +0200 Subject: [PATCH] support path with tilde --- src/main.d | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/main.d b/src/main.d index 2828cde9..724fd85c 100644 --- a/src/main.d +++ b/src/main.d @@ -1,5 +1,5 @@ import core.time, core.thread; -import std.getopt, std.file, std.process, std.stdio; +import std.getopt, std.file, std.path, std.process, std.stdio; import config, itemdb, monitor, onedrive, sync; string ver = "1.0"; @@ -24,8 +24,7 @@ void main(string[] args) return; } - string homeDirName = environment["HOME"]; - string configDirName = environment.get("XDG_CONFIG_HOME", homeDirName ~ "/.config") ~ "/onedrive"; + string configDirName = expandTilde(environment.get("XDG_CONFIG_HOME", "~/.config")) ~ "/onedrive"; string configFilePath = configDirName ~ "/config"; string refreshTokenFilePath = configDirName ~ "/refresh_token"; string statusTokenFilePath = configDirName ~ "/status_token"; @@ -69,7 +68,7 @@ void main(string[] args) // swallow exception } - string syncDir = cfg.get("sync_dir"); + string syncDir = expandTilde(cfg.get("sync_dir")); chdir(syncDir); sync.applyDifferences(); sync.scanForDifferences(".");