From: sirakaba Date: Fri, 24 Sep 2010 11:58:02 +0000 (+0000) Subject: 上書き確認を実装。 X-Git-Tag: 0.01beta8~23 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=13aa9024facfef325eeaee59c212213e150e60ed;p=tpi%2Flychee.git 上書き確認を実装。 git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@345 9df91469-1e22-0410-86e7-ea8537beb833 --- diff --git a/src/plugin/7zArc/7zArc.cpp b/src/plugin/7zArc/7zArc.cpp index fec9acd..6dcdcc8 100644 --- a/src/plugin/7zArc/7zArc.cpp +++ b/src/plugin/7zArc/7zArc.cpp @@ -406,10 +406,10 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(unsigned int nIndex, ISequential // 前のファイルの処理の終了を通知。 this->nCurrentPos += this->piInfo.fiInfo.nUnpackedSize; - this->piInfo.eMessage = TPI_MESSAGE_STATUS; if (this->nCurrentPos != 0) { - this->piInfo.eStatus = TPI_STATUS_ENDPROCESS; + this->piInfo.eMessage = TPI_MESSAGE_STATUS; + this->piInfo.eStatus = TPI_STATUS_ENDPROCESS; if (g_prProc != NULL && g_prProc(TPI_NOTIFY_COMMON, & this->piInfo) != TPI_CALLBACK_CONTINUE) { this->nErrorCode = TPI_ERROR_D_SKIPPED; @@ -417,8 +417,9 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(unsigned int nIndex, ISequential } } - // ファイルの基本情報を取得。 - this->piInfo.eStatus = TPI_STATUS_BEGINPROCESS; + // ファイルを処理するか確認。 + this->piInfo.eMessage = TPI_MESSAGE_ASK; + this->piInfo.eStatus = TPI_PARAM_DEST; GetFileInformation2(this->hArc, & this->piInfo.fiInfo, nIndex); this->piInfo.fnDestination = wxFileName(swInfo->fnDestinationDirectory.GetFullPath() + wxFileName::GetPathSeparator() + (swInfo->fStoreDirectoryPathes ? this->piInfo.fiInfo.fnFileName.GetPath() : (wxString) wxEmptyString), this->piInfo.fiInfo.fnFileName.GetFullName()); if (g_prProc != NULL && g_prProc(TPI_NOTIFY_COMMON, & this->piInfo) != TPI_CALLBACK_CONTINUE) @@ -426,6 +427,19 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(unsigned int nIndex, ISequential this->nErrorCode = TPI_ERROR_D_SKIPPED; return E_ABORT; } + if (! piInfo.fnDestination.IsOk()) + { + return S_OK; + } + + // ファイルの基本情報を取得。 + this->piInfo.eMessage = TPI_MESSAGE_STATUS; + this->piInfo.eStatus = TPI_STATUS_BEGINPROCESS; + if (g_prProc != NULL && g_prProc(TPI_NOTIFY_COMMON, & this->piInfo) != TPI_CALLBACK_CONTINUE) + { + this->nErrorCode = TPI_ERROR_D_SKIPPED; + return E_ABORT; + } if (nExtractMode != NArchive::NExtract::NAskMode::kExtract) { @@ -443,19 +457,10 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(unsigned int nIndex, ISequential return S_OK; } - if (::wxFileExists(this->piInfo.fnDestination.GetFullPath())) - { - // 既にファイルが存在する場合。 - if (! ::wxRemoveFile(this->piInfo.fnDestination.GetFullPath())) - { - this->nErrorCode = TPI_ERROR_IO_FILE_DELETE; - return E_ABORT; - } - } - + // ファイルを作成。 _outFileStreamSpec = new COutFileStream; CMyComPtr outStreamLoc(_outFileStreamSpec); - if (! _outFileStreamSpec->Open(this->piInfo.fnDestination.GetFullPath(), CREATE_ALWAYS)) + if (! _outFileStreamSpec->Open(this->piInfo.fnDestination.GetFullPath(), CREATE_NEW)) { this->nErrorCode = TPI_ERROR_IO_FILE_OPEN; return E_ABORT;