Skip to content

Commit

Permalink
Always split path in CExtractDialog. (#537)
Browse files Browse the repository at this point in the history
Even if the archive name checkbox in CExtractDialog is not checked, NanaZip
appends the archive name to its extraction path anyway. Fix this issue by
always splitting the extraction path in NanaZip.Windows.
  • Loading branch information
dinhngtu authored Jan 1, 2025
1 parent 27f148f commit a32520b
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 25 deletions.
30 changes: 21 additions & 9 deletions NanaZip.Core/SevenZip/CPP/7zip/UI/GUI/ExtractDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -192,19 +192,31 @@ bool CExtractDialog::OnInit()
UString pathPrefix = DirPath;

#ifndef Z7_SFX


// **************** NanaZip Modification Start ****************
UString pathName;
SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
if (pathPrefix.IsEmpty())
pathPrefix = pathName;
else
_pathName.SetText(pathName);

//if (_info.SplitDest.Val)
//{
// CheckButton(IDX_EXTRACT_NAME_ENABLE, true);
// UString pathName;
// SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
// if (pathPrefix.IsEmpty())
// pathPrefix = pathName;
// else
// _pathName.SetText(pathName);
//}

if (_info.SplitDest.Val)
{
CheckButton(IDX_EXTRACT_NAME_ENABLE, true);
UString pathName;
SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
if (pathPrefix.IsEmpty())
pathPrefix = pathName;
else
_pathName.SetText(pathName);
}
else
ShowItem_Bool(IDE_EXTRACT_NAME, false);
// **************** NanaZip Modification End ****************

#endif

Expand Down
28 changes: 20 additions & 8 deletions NanaZip.UI.Classic/SevenZip/CPP/7zip/UI/GUI/ExtractDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,30 @@ bool CExtractDialog::OnInit()

#ifndef _SFX

// **************** NanaZip Modification Start ****************
UString pathName;
SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
if (pathPrefix.IsEmpty())
pathPrefix = pathName;
else
_pathName.SetText(pathName);

//if (_info.SplitDest.Val)
//{
// CheckButton(IDX_EXTRACT_NAME_ENABLE, true);
// UString pathName;
// SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
// if (pathPrefix.IsEmpty())
// pathPrefix = pathName;
// else
// _pathName.SetText(pathName);
//}

if (_info.SplitDest.Val)
{
CheckButton(IDX_EXTRACT_NAME_ENABLE, true);
UString pathName;
SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
if (pathPrefix.IsEmpty())
pathPrefix = pathName;
else
_pathName.SetText(pathName);
}
else
ShowItem_Bool(IDE_EXTRACT_NAME, false);
// **************** NanaZip Modification End ****************

#endif

Expand Down
28 changes: 20 additions & 8 deletions NanaZip.UI.Modern/SevenZip/CPP/7zip/UI/GUI/ExtractDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -188,18 +188,30 @@ bool CExtractDialog::OnInit()

#ifndef _SFX

// **************** NanaZip Modification Start ****************
UString pathName;
SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
if (pathPrefix.IsEmpty())
pathPrefix = pathName;
else
_pathName.SetText(pathName);

//if (_info.SplitDest.Val)
//{
// CheckButton(IDX_EXTRACT_NAME_ENABLE, true);
// UString pathName;
// SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
// if (pathPrefix.IsEmpty())
// pathPrefix = pathName;
// else
// _pathName.SetText(pathName);
//}

if (_info.SplitDest.Val)
{
CheckButton(IDX_EXTRACT_NAME_ENABLE, true);
UString pathName;
SplitPathToParts_Smart(DirPath, pathPrefix, pathName);
if (pathPrefix.IsEmpty())
pathPrefix = pathName;
else
_pathName.SetText(pathName);
}
else
ShowItem_Bool(IDE_EXTRACT_NAME, false);
// **************** NanaZip Modification End ****************

#endif

Expand Down

0 comments on commit a32520b

Please sign in to comment.