OSDN Git Service

上書き確認を実装。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Fri, 24 Sep 2010 11:58:02 +0000 (11:58 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Fri, 24 Sep 2010 11:58:02 +0000 (11:58 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@345 9df91469-1e22-0410-86e7-ea8537beb833

src/plugin/7zArc/7zArc.cpp

index fec9acd..6dcdcc8 100644 (file)
@@ -406,10 +406,10 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(unsigned int nIndex, ISequential
 \r
        // 前のファイルの処理の終了を通知。\r
        this->nCurrentPos += this->piInfo.fiInfo.nUnpackedSize;\r
-       this->piInfo.eMessage               = TPI_MESSAGE_STATUS;\r
        if (this->nCurrentPos != 0)\r
        {\r
-               this->piInfo.eStatus            = TPI_STATUS_ENDPROCESS;\r
+               this->piInfo.eMessage   = TPI_MESSAGE_STATUS;\r
+               this->piInfo.eStatus    = TPI_STATUS_ENDPROCESS;\r
                if (g_prProc != NULL && g_prProc(TPI_NOTIFY_COMMON, & this->piInfo) != TPI_CALLBACK_CONTINUE)\r
                {\r
                        this->nErrorCode = TPI_ERROR_D_SKIPPED;\r
@@ -417,8 +417,9 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(unsigned int nIndex, ISequential
                }\r
        }\r
 \r
-       // ファイルの基本情報を取得。\r
-       this->piInfo.eStatus                = TPI_STATUS_BEGINPROCESS;\r
+       // ファイルを処理するか確認。\r
+       this->piInfo.eMessage   = TPI_MESSAGE_ASK;\r
+       this->piInfo.eStatus    = TPI_PARAM_DEST;\r
        GetFileInformation2(this->hArc, & this->piInfo.fiInfo, nIndex);\r
        this->piInfo.fnDestination          = wxFileName(swInfo->fnDestinationDirectory.GetFullPath() + wxFileName::GetPathSeparator() + (swInfo->fStoreDirectoryPathes ? this->piInfo.fiInfo.fnFileName.GetPath() : (wxString) wxEmptyString), this->piInfo.fiInfo.fnFileName.GetFullName());\r
        if (g_prProc != NULL && g_prProc(TPI_NOTIFY_COMMON, & this->piInfo) != TPI_CALLBACK_CONTINUE)\r
@@ -426,6 +427,19 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(unsigned int nIndex, ISequential
                this->nErrorCode = TPI_ERROR_D_SKIPPED;\r
                return E_ABORT;\r
        }\r
+       if (! piInfo.fnDestination.IsOk())\r
+       {\r
+               return S_OK;\r
+       }\r
+\r
+       // ファイルの基本情報を取得。\r
+       this->piInfo.eMessage   = TPI_MESSAGE_STATUS;\r
+       this->piInfo.eStatus    = TPI_STATUS_BEGINPROCESS;\r
+       if (g_prProc != NULL && g_prProc(TPI_NOTIFY_COMMON, & this->piInfo) != TPI_CALLBACK_CONTINUE)\r
+       {\r
+               this->nErrorCode = TPI_ERROR_D_SKIPPED;\r
+               return E_ABORT;\r
+       }\r
 \r
        if (nExtractMode != NArchive::NExtract::NAskMode::kExtract)\r
        {\r
@@ -443,19 +457,10 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(unsigned int nIndex, ISequential
                return S_OK;\r
        }\r
 \r
-       if (::wxFileExists(this->piInfo.fnDestination.GetFullPath()))\r
-       {\r
-               // 既にファイルが存在する場合。\r
-               if (! ::wxRemoveFile(this->piInfo.fnDestination.GetFullPath()))\r
-               {\r
-                       this->nErrorCode = TPI_ERROR_IO_FILE_DELETE;\r
-                       return E_ABORT;\r
-               }\r
-       }\r
-\r
+       // ファイルを作成。\r
        _outFileStreamSpec = new COutFileStream;\r
        CMyComPtr<ISequentialOutStream> outStreamLoc(_outFileStreamSpec);\r
-       if (! _outFileStreamSpec->Open(this->piInfo.fnDestination.GetFullPath(), CREATE_ALWAYS))\r
+       if (! _outFileStreamSpec->Open(this->piInfo.fnDestination.GetFullPath(), CREATE_NEW))\r
        {\r
                this->nErrorCode = TPI_ERROR_IO_FILE_OPEN;\r
                return E_ABORT;\r