OSDN Git Service

TPI内部でのパスのハードコーディングを撤廃。
[tpi/lychee.git] / src / plugin / cuiWrapper / cuiWrapper.cpp
index 1718bef..1ee4032 100644 (file)
@@ -23,6 +23,7 @@
 //    Includes\r
 //******************************************************************************\r
 \r
+#define MYUSE_LIBPATH 1\r
 #include "../../common/header/plugin.h"\r
 #include "../../common/header/plugin-extra.h"\r
 #include "../../common/library/library.h"\r
@@ -182,6 +183,9 @@ int __stdcall GetPluginInformation
        case TPI_INFO_VERSION_API:\r
                * (int *) _pPtr = 2;\r
                break;\r
+       case TPI_INFO_HANDLE_ON_COMMAND:\r
+               * (int *) _pPtr = 0;\r
+               break;\r
        default:\r
                return TPI_ERROR_D_UNSUPPORTED;\r
        }\r
@@ -211,7 +215,7 @@ int __stdcall GetFormatInformation(TPI_FORMATINFO * _fiInfo, bool _bFirst)
 \r
        MakeFormatInfo(xmlLibrary, wxT("cuiWrapper"), _fiInfo, s_nFileId++);\r
        wxString szExeFile = xmlLibrary->GetAttribute(wxT("name"), wxEmptyString);\r
-       if (myExecute(szExeFile, NULL, wxEmptyString, szExeFile.EndsWith(wxT(".exe"))) != TPI_ERROR_SUCCESS)\r
+       if (myExecute(szExeFile, NULL, wxEmptyString, szExeFile.MakeLower().EndsWith(wxT(".exe"))) != TPI_ERROR_SUCCESS)\r
        {\r
                _fiInfo->eSupportedCommand = 0;\r
        }\r
@@ -265,7 +269,7 @@ int __stdcall LoadPlugin
                        {\r
                                // .tar.XXXなど二重判定への対応。\r
 //                             if (asExt[i].IsSameAs(fnArchive.GetExt(), false))\r
-                               if (fnArchive.GetFullName().EndsWith(wxT('.') + asExt[i]))\r
+                               if (fnArchive.GetFullName().MakeLower().EndsWith(wxT('.') + asExt[i].MakeLower()))\r
                                {\r
                                        // ライブラリをロード。\r
                                        g_LibInfo.szExeFile = xmlLibrary->GetAttribute(wxT("name"), wxEmptyString);\r
@@ -297,7 +301,9 @@ int __stdcall OpenArchive
 )\r
 {\r
        wxString szOutput;\r
-       if (myExecute(g_LibInfo.szExeFile + wxT(" ") + MakeCommandLineSend(g_LibInfo.node.GetAttribute(wxT("list"), wxEmptyString), _szArcName), & szOutput, wxEmptyString, g_LibInfo.szExeFile.EndsWith(wxT(".exe"))) != TPI_ERROR_SUCCESS)\r
+       TPI_SWITCHES swInfo;\r
+       swInfo.szArcName = _szArcName;\r
+       if (myExecute(g_LibInfo.szExeFile + wxT(" ") + MakeCommandLineSend(g_LibInfo.node.GetAttribute(wxT("list"), wxEmptyString), & swInfo), & szOutput, wxEmptyString, g_LibInfo.szExeFile.MakeLower().EndsWith(wxT(".exe"))) != TPI_ERROR_SUCCESS)\r
        {\r
                return TPI_ERROR_U_USE_LIBRARY;\r
        }\r
@@ -310,13 +316,14 @@ int __stdcall OpenArchive
        }\r
 \r
        wxString szStartLine = g_LibInfo.node.GetAttribute(wxT("list-line-s"), wxEmptyString);\r
-       if (! szStartLine.IsEmpty() && as->Index(szStartLine) == wxNOT_FOUND)\r
+       if ((! szStartLine.IsEmpty() && as->Index(szStartLine) == wxNOT_FOUND) || as->IsEmpty())\r
        {\r
                // 書庫が読み込めなかった?\r
+               delete as;\r
                return TPI_ERROR_ARC_UNSUPPORTED;\r
        }\r
 \r
-       return as->IsEmpty() ? TPI_ERROR_UNDEFINED : TPI_ERROR_SUCCESS;\r
+       return TPI_ERROR_SUCCESS;\r
 }\r
 \r
 int __stdcall CloseArchive\r
@@ -418,7 +425,7 @@ int __stdcall Command
 (\r
        wxULongLong_t _eCommand,\r
        TPI_SWITCHES * _swInfo,\r
-       const wxString & _szArcName,\r
+       void *,// _hArchive,\r
        const wxArrayString & _szFiles\r
 )\r
 {\r
@@ -459,11 +466,11 @@ int __stdcall Command
        // コマンドライン・レスポンスファイル作成。\r
        wxString\r
                szResponceFileName = MakeResponceFile(_szFiles, myGetAttributeBool(& g_LibInfo.node, wxT("quote-resp"), true)),\r
-               szCommandLineSend  = MakeCommandLineSend(szCommandLine, _szArcName, _swInfo, _szFiles, szResponceFileName);\r
+               szCommandLineSend  = MakeCommandLineSend(szCommandLine, _swInfo, _szFiles, szResponceFileName);\r
 \r
        // コマンドライン実行。\r
        wxString szOutput;\r
-       int nErrorCode = myExecute(g_LibInfo.szExeFile + wxT(" ") + szCommandLineSend, & szOutput, _swInfo->fnDestinationDirectory.GetFullPath(), g_LibInfo.szExeFile.EndsWith(wxT(".exe")));\r
+       int nErrorCode = myExecute(g_LibInfo.szExeFile + wxT(" ") + szCommandLineSend, & szOutput, _swInfo->fnDestinationDirectory.GetFullPath(), g_LibInfo.szExeFile.MakeLower().EndsWith(wxT(".exe")));\r
 \r
        // レスポンスファイル削除。\r
        ::wxRemoveFile(szResponceFileName);\r