From 28ec300c12661c0584dc3a91b8b7ee8668b1e39b Mon Sep 17 00:00:00 2001 From: morkt Date: Sat, 1 Aug 2015 00:19:59 +0400 Subject: [PATCH] remember last directory used for extraction. --- App.config | 3 +++ GarExtract.cs | 8 ++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/App.config b/App.config index 34321363..8da65c22 100644 --- a/App.config +++ b/App.config @@ -88,6 +88,9 @@ False + + + diff --git a/GarExtract.cs b/GarExtract.cs index 65de5744..4acb3856 100644 --- a/GarExtract.cs +++ b/GarExtract.cs @@ -55,13 +55,15 @@ namespace GARbro.GUI GarExtract extractor = null; try { + string destination = Settings.Default.appLastDestination; if (!ViewModel.IsArchive) { if (!entry.IsDirectory) { var arc_dir = CurrentPath; var source = Path.Combine (arc_dir, entry.Name); - string destination = arc_dir; + if (string.IsNullOrEmpty (destination)) + destination = arc_dir; // extract into directory named after archive if (!string.IsNullOrEmpty (Path.GetExtension (entry.Name))) destination = Path.GetFileNameWithoutExtension (source); @@ -72,7 +74,8 @@ namespace GARbro.GUI else if (null != m_app.CurrentArchive) { var vm = ViewModel as ArchiveViewModel; - string destination = Path.GetDirectoryName (vm.Path); + if (string.IsNullOrEmpty (destination)) + destination = Path.GetDirectoryName (vm.Path); extractor = new GarExtract (this, vm.Path, m_app.CurrentArchive); if (null == entry || (entry.Name == ".." && vm.SubDir == "")) // root entry extractor.ExtractAll (destination); @@ -150,6 +153,7 @@ namespace GARbro.GUI { Directory.CreateDirectory (destination); Directory.SetCurrentDirectory (destination); + Settings.Default.appLastDestination = destination; } finally {