diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2008-11-23 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:57 +0300 |
commit | b717a4dbfe15fd7540e68e6c5ccbe91901bbadba (patch) | |
tree | c89b25a1f9a690e69cd20e313be9eb4180ee7a6f /CPP/7zip/Bundles | |
parent | c10e6b16f6d5484ed896b2c614cb7fb77f336d24 (diff) |
4.61 beta
Diffstat (limited to 'CPP/7zip/Bundles')
-rwxr-xr-x | CPP/7zip/Bundles/SFXCon/Main.cpp | 55 | ||||
-rwxr-xr-x | CPP/7zip/Bundles/SFXCon/SFXCon.dsp | 8 | ||||
-rwxr-xr-x | CPP/7zip/Bundles/SFXCon/makefile | 1 | ||||
-rwxr-xr-x | CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp | 23 |
4 files changed, 48 insertions, 39 deletions
diff --git a/CPP/7zip/Bundles/SFXCon/Main.cpp b/CPP/7zip/Bundles/SFXCon/Main.cpp index 5ae6878d..ac8c1cdf 100755 --- a/CPP/7zip/Bundles/SFXCon/Main.cpp +++ b/CPP/7zip/Bundles/SFXCon/Main.cpp @@ -5,27 +5,30 @@ #include "Common/MyInitGuid.h" #include "Common/CommandLineParser.h" -#include "Common/StdOutStream.h" -#include "Common/Wildcard.h" -#include "Common/StringConvert.h" #include "Common/MyCom.h" #include "Common/MyException.h" +#include "Common/StdOutStream.h" +#include "Common/StringConvert.h" +#include "Common/Wildcard.h" -#include "Windows/FileDir.h" -#include "Windows/FileName.h" #include "Windows/Defs.h" +#include "Windows/FileName.h" +#ifdef _WIN32 +#include "Windows/DLL.h" +#include "Windows/FileDir.h" +#endif #include "../../IPassword.h" #include "../../ICoder.h" -#include "../../UI/Common/OpenArchive.h" #include "../../UI/Common/DefaultName.h" #include "../../UI/Common/ExitCode.h" #include "../../UI/Common/Extract.h" +#include "../../UI/Common/OpenArchive.h" +#include "../../UI/Console/ExtractCallbackConsole.h" #include "../../UI/Console/List.h" #include "../../UI/Console/OpenCallbackConsole.h" -#include "../../UI/Console/ExtractCallbackConsole.h" #include "../../MyVersion.h" @@ -40,11 +43,6 @@ static const char *kCopyrightString = static const int kNumSwitches = 6; -#ifdef _WIN32 -static const wchar_t *kDefaultExt = L".exe"; -static const int kDefaultExtLength = 4; -#endif - namespace NKey { enum Enum { @@ -271,7 +269,25 @@ int Main2( GetArguments(numArguments, arguments, commandStrings); #endif - UString archiveName = commandStrings.Front(); + #ifdef _WIN32 + + UString arcPath; + { + UString path; + NDLL::MyGetModuleFileName(NULL, path); + int fileNamePartStartIndex; + if (!NDirectory::MyGetFullPathName(path, arcPath, fileNamePartStartIndex)) + { + g_StdOut << "GetFullPathName Error"; + return NExitCode::kFatalError; + } + } + + #else + + UString arcPath = commandStrings.Front(); + + #endif commandStrings.Delete(0); @@ -318,11 +334,6 @@ int Main2( bool yesToAll = parser[NKey::kYes].ThereIs; - #ifdef _WIN32 - if (archiveName.Right(kDefaultExtLength).CompareNoCase(kDefaultExt) != 0) - archiveName += kDefaultExt; - #endif - // NExtractMode::EEnum extractMode; // bool isExtractGroupCommand = command.IsFromExtractGroup(extractMode); @@ -333,13 +344,13 @@ int Main2( password = parser[NKey::kPassword].PostStrings[0]; NFind::CFileInfoW archiveFileInfo; - if (!NFind::FindFile(archiveName, archiveFileInfo)) + if (!NFind::FindFile(arcPath, archiveFileInfo)) throw kCantFindSFX; if (archiveFileInfo.IsDir()) throw kCantFindSFX; UString outputDir; - if(parser[NKey::kOutputDir].ThereIs) + if (parser[NKey::kOutputDir].ThereIs) { outputDir = parser[NKey::kOutputDir].PostStrings[0]; NName::NormalizeDirPathPrefix(outputDir); @@ -347,8 +358,8 @@ int Main2( { UStringVector v1, v2; - v1.Add(archiveName); - v2.Add(archiveName); + v1.Add(arcPath); + v2.Add(arcPath); const NWildcard::CCensorNode &wildcardCensorHead = wildcardCensor.Pairs.Front().Head; diff --git a/CPP/7zip/Bundles/SFXCon/SFXCon.dsp b/CPP/7zip/Bundles/SFXCon/SFXCon.dsp index e272d88d..7d1f73a2 100755 --- a/CPP/7zip/Bundles/SFXCon/SFXCon.dsp +++ b/CPP/7zip/Bundles/SFXCon/SFXCon.dsp @@ -381,6 +381,14 @@ SOURCE=..\..\Crypto\Hash\RotateDefs.h # PROP Default_Filter "" # Begin Source File +SOURCE=..\..\..\Windows\DLL.cpp +# End Source File +# Begin Source File + +SOURCE=..\..\..\Windows\DLL.h +# End Source File +# Begin Source File + SOURCE=..\..\..\Windows\Error.cpp # End Source File # Begin Source File diff --git a/CPP/7zip/Bundles/SFXCon/makefile b/CPP/7zip/Bundles/SFXCon/makefile index c32b11cd..4bfe7f3d 100755 --- a/CPP/7zip/Bundles/SFXCon/makefile +++ b/CPP/7zip/Bundles/SFXCon/makefile @@ -29,6 +29,7 @@ COMMON_OBJS = \ $O\Wildcard.obj \ WIN_OBJS = \ + $O\DLL.obj \ $O\Error.obj \ $O\FileDir.obj \ $O\FileFind.obj \ diff --git a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp index f2af88e6..5ec72dc4 100755 --- a/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp +++ b/CPP/7zip/Bundles/SFXSetup/ExtractCallback.cpp @@ -106,8 +106,6 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index, } _filePath = fullPath; - // m_CurrentFilePath = GetSystemString(fullPath, _codePage); - if (askExtractMode == NArchive::NExtract::NAskMode::kExtract) { NCOM::CPropVariant prop; @@ -135,14 +133,9 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index, RINOK(_archiveHandler->GetProperty(index, kpidMTime, &prop)); switch(prop.vt) { - case VT_EMPTY: - _processedFileInfo.MTime = _defaultMTime; - break; - case VT_FILETIME: - _processedFileInfo.MTime = prop.filetime; - break; - default: - return E_FAIL; + case VT_EMPTY: _processedFileInfo.MTime = _defaultMTime; break; + case VT_FILETIME: _processedFileInfo.MTime = prop.filetime; break; + default: return E_FAIL; } UStringVector pathParts; @@ -168,6 +161,8 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index, if (isAnti) NDirectory::MyRemoveDirectory(_diskFilePath); + else + NDirectory::SetDirTime(_diskFilePath, NULL, NULL, &_processedFileInfo.MTime); return S_OK; } @@ -204,13 +199,7 @@ STDMETHODIMP CExtractCallbackImp::GetStream(UInt32 index, STDMETHODIMP CExtractCallbackImp::PrepareOperation(Int32 askExtractMode) { - _extractMode = false; - switch (askExtractMode) - { - case NArchive::NExtract::NAskMode::kExtract: - _extractMode = true; - break; - }; + _extractMode = (askExtractMode == NArchive::NExtract::NAskMode::kExtract); return S_OK; } |