OSDN Git Service

単ファイル格納形式の処理において、書庫ファイル名から格納ファイル名を生成する機能を追加。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Tue, 9 Nov 2010 13:09:02 +0000 (13:09 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Tue, 9 Nov 2010 13:09:02 +0000 (13:09 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@428 9df91469-1e22-0410-86e7-ea8537beb833

doc/history.html
src/lychee/frm_main.cpp
src/plugin/7zArc/7zArc.cpp

index c3439ba..ea99ee4 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8" ?>\r
+<?xml version="1.0" encoding="utf-8" ?>\r
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\r
 <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ja">\r
  <head>\r
@@ -34,6 +34,7 @@
        <li class="add">書庫からクリップボードへファイルをコピーする機能を追加。</li>\r
        <li class="add">書庫を複製する機能を追加。</li>\r
        <li class="add">ツリービューとリストビューでコンテキストメニューを表示する機能を追加。</li>\r
+       <li class="add">単ファイル格納形式の処理において、書庫ファイル名から格納ファイル名を生成する機能を追加。</li>\r
        <li class="chg">ファイルを開く動作でアプリケーションが起動している間も、Lycheeのウインドウを操作できるよう変更。</li>\r
        <li class="chg">書庫閲覧時のメモリ使用量を削減。</li>\r
        <li class="chg">書庫のアイコンを変更。</li>\r
index 8ff8498..816afd8 100644 (file)
@@ -406,6 +406,13 @@ void MainFrame::OnArcOpen(wxCommandEvent& e)
                                piInfo.fiInfo.fnFileName = wxFileName(szPath.AfterFirst(wxT('/')), piInfo.fiInfo.fnFileName.GetFullName(), wxPATH_DOS);\r
                        }\r
 \r
+                       // 拡張子のみ設定されている場合。\r
+                       if (piInfo.fiInfo.szStoredName.IsEmpty())\r
+                       {\r
+                               piInfo.fiInfo.szStoredName = this->fnArchive.GetName() + wxT('.') + piInfo.fiInfo.fnFileName.GetExt();\r
+                               piInfo.fiInfo.fnFileName = wxFileName(piInfo.fiInfo.szStoredName);\r
+                       }\r
+\r
                        // ツリービューに反映。\r
                        bool fDir = piInfo.fiInfo.dwAttribute & TPI_ATTRIBUTE_DIRECTORY ? true : false;\r
                        TreeView_CheckNewerItem(this->tree_ctrl, idArcRoot, fDir ? piInfo.fiInfo.fnFileName.GetFullPath() : piInfo.fiInfo.fnFileName.GetPath(), true);\r
index af94baf..57faf06 100644 (file)
@@ -1,4 +1,4 @@
-/*******************************************************************************\r
+/*******************************************************************************\r
   TPI - flexible but useless plug-in framework.\r
   Copyright (C) 2002-2009 Silky\r
 \r
@@ -117,13 +117,14 @@ int GetFileInformation2(void * _hArchive, TPI_FILEINFO * _fiInfo, wxULongLong_t
        if (prop.vt == VT_BSTR)\r
        {\r
                _fiInfo->szStoredName = WC2String(prop.bstrVal);\r
+               _fiInfo->fnFileName   = wxFileName(_fiInfo->szStoredName, wxPATH_DOS);\r
        }\r
        else\r
        {\r
                hArc->GetProperty(nIndex, kpidExtension, & prop);\r
-               _fiInfo->szStoredName = wxT("data") + (prop.vt == VT_BSTR ? wxT(".") + WC2String(prop.bstrVal) : (wxString) wxEmptyString);\r
+               _fiInfo->szStoredName.Empty();\r
+               _fiInfo->fnFileName.SetExt(WC2String(prop.bstrVal));\r
        }\r
-       _fiInfo->fnFileName     = wxFileName(_fiInfo->szStoredName, wxPATH_DOS);\r
        hArc->GetProperty(nIndex, kpidMethod,  & prop); _fiInfo->szMethod   = prop.vt == VT_BSTR ? WC2String(prop.bstrVal) : (wxString) wxEmptyString;\r
        hArc->GetProperty(nIndex, kpidComment, & prop); _fiInfo->szComment  = prop.vt == VT_BSTR ? WC2String(prop.bstrVal) : (wxString) wxEmptyString;\r
        hArc->GetProperty(nIndex, kpidUser,    & prop); _fiInfo->szUser     = prop.vt == VT_BSTR ? WC2String(prop.bstrVal) : (wxString) wxEmptyString;\r
@@ -384,6 +385,7 @@ public:
 \r
        int nErrorCode;\r
        TPI_SWITCHES * swInfo;\r
+       wxFileName fnArchive;\r
 \r
 private:\r
        int nMode;\r
@@ -444,6 +446,12 @@ STDMETHODIMP CArchiveExtractCallback::GetStream(unsigned int nIndex, ISequential
        this->piInfo.eMessage   = TPI_MESSAGE_ASK;\r
        this->piInfo.eStatus    = TPI_PARAM_DEST;\r
        GetFileInformation2(this->hArc, & this->piInfo.fiInfo, nIndex);\r
+       if (this->piInfo.fiInfo.szStoredName.IsEmpty())\r
+       {\r
+               this->piInfo.fiInfo.szStoredName = this->fnArchive.GetName() + wxT('.') + this->piInfo.fiInfo.fnFileName.GetExt();\r
+               this->piInfo.fiInfo.fnFileName = wxFileName(this->piInfo.fiInfo.szStoredName);\r
+       }\r
+\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
        {\r
@@ -968,10 +976,15 @@ int __stdcall Command
                // ファイル名からインデックスを取得。\r
                TPI_FILEINFO fiInfo;\r
                CRecordVector<unsigned int> nIndexes;\r
+               wxFileName fnArchive = wxFileName(_szArcName);\r
                if (GetFileInformation(hArc, & fiInfo, true) == TPI_ERROR_SUCCESS)\r
                {\r
                        do\r
                        {\r
+                               if (fiInfo.szStoredName.IsEmpty())\r
+                               {\r
+                                       fiInfo.szStoredName = fnArchive.GetName() + wxT('.') + fiInfo.fnFileName.GetExt();\r
+                               }\r
                                if (_szFiles.Index(fiInfo.szStoredName) != wxNOT_FOUND)\r
                                {\r
                                        nIndexes.Add(fiInfo.nFileId);\r
@@ -981,6 +994,7 @@ int __stdcall Command
                }\r
 \r
                CArchiveExtractCallback * extractCallbackSpec = new CArchiveExtractCallback(hArc,_swInfo);\r
+               extractCallbackSpec->fnArchive = fnArchive;\r
                CMyComPtr<IArchiveExtractCallback> extractCallback(extractCallbackSpec);\r
                hArc->Extract(& nIndexes.Front(), nIndexes.Size(), _eCommand == TPI_COMMAND_TEST, extractCallback);\r
                nErrorCode = extractCallbackSpec->nErrorCode;\r