From c24f58ee01aba1d569809d1f25b06ec0e6f04ef7 Mon Sep 17 00:00:00 2001 From: chylex <info@chylex.com> Date: Wed, 15 Apr 2015 18:51:42 +0200 Subject: [PATCH] Fixed current directory when running via explorer integration --- BackupEssentials/App.xaml.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/BackupEssentials/App.xaml.cs b/BackupEssentials/App.xaml.cs index a2c7da5..8e2ace6 100644 --- a/BackupEssentials/App.xaml.cs +++ b/BackupEssentials/App.xaml.cs @@ -34,6 +34,7 @@ namespace BackupEssentials{ string dest = parser.GetValue("dest",""); if (int.TryParse(parser.GetValue("locid","-1"),out locid) && locid >= 0){ + Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); DataStorage.Load(DataStorage.Type.Locations); if (locid < DataStorage.BackupLocationList.Count){ @@ -45,9 +46,10 @@ namespace BackupEssentials{ BackupRunInfo info = new BackupRunInfo(parser.GetMultiValue("src"),dest); new BackupWindow(new BackupRunner(info)).Show(); } - else Application.Current.Shutdown(); + else throw new ArgumentException("Backup could not begin, destination is empty. Program arguments: "+string.Join(" ",args.Args)); } else if (parser.HasFlag("runcompat")){ + Directory.SetCurrentDirectory(AppDomain.CurrentDomain.BaseDirectory); MainWindow window = new MainWindow(); window.ShowPage(typeof(BackupDrop),new object[]{ parser.GetMultiValue("src"), null, true }); window.Show();