remember last directory used for extraction.

This commit is contained in:
morkt
2015-08-01 00:19:59 +04:00
parent d0a09261e7
commit 28ec300c12
2 changed files with 9 additions and 2 deletions

View File

@@ -88,6 +88,9 @@
<setting name="appIgnoreConversionErrors" serializeAs="String"> <setting name="appIgnoreConversionErrors" serializeAs="String">
<value>False</value> <value>False</value>
</setting> </setting>
<setting name="appLastDestination" serializeAs="String">
<value />
</setting>
</GARbro.GUI.Properties.Settings> </GARbro.GUI.Properties.Settings>
</userSettings> </userSettings>
</configuration> </configuration>

View File

@@ -55,13 +55,15 @@ namespace GARbro.GUI
GarExtract extractor = null; GarExtract extractor = null;
try try
{ {
string destination = Settings.Default.appLastDestination;
if (!ViewModel.IsArchive) if (!ViewModel.IsArchive)
{ {
if (!entry.IsDirectory) if (!entry.IsDirectory)
{ {
var arc_dir = CurrentPath; var arc_dir = CurrentPath;
var source = Path.Combine (arc_dir, entry.Name); 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 // extract into directory named after archive
if (!string.IsNullOrEmpty (Path.GetExtension (entry.Name))) if (!string.IsNullOrEmpty (Path.GetExtension (entry.Name)))
destination = Path.GetFileNameWithoutExtension (source); destination = Path.GetFileNameWithoutExtension (source);
@@ -72,7 +74,8 @@ namespace GARbro.GUI
else if (null != m_app.CurrentArchive) else if (null != m_app.CurrentArchive)
{ {
var vm = ViewModel as ArchiveViewModel; 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); extractor = new GarExtract (this, vm.Path, m_app.CurrentArchive);
if (null == entry || (entry.Name == ".." && vm.SubDir == "")) // root entry if (null == entry || (entry.Name == ".." && vm.SubDir == "")) // root entry
extractor.ExtractAll (destination); extractor.ExtractAll (destination);
@@ -150,6 +153,7 @@ namespace GARbro.GUI
{ {
Directory.CreateDirectory (destination); Directory.CreateDirectory (destination);
Directory.SetCurrentDirectory (destination); Directory.SetCurrentDirectory (destination);
Settings.Default.appLastDestination = destination;
} }
finally finally
{ {