OSDN Git Service

TPI内部でのパスのハードコーディングを撤廃。
authorsirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Sun, 18 Mar 2012 02:47:18 +0000 (02:47 +0000)
committersirakaba <sirakaba@9df91469-1e22-0410-86e7-ea8537beb833>
Sun, 18 Mar 2012 02:47:18 +0000 (02:47 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/tpi/tpi@606 9df91469-1e22-0410-86e7-ea8537beb833

doc/history.html
src/common/library/library.h
src/common/library/xmldoc.h
src/plugin/7zArc/7zArc.cpp
src/plugin/calLibrary/calLibrary.cpp
src/plugin/cuiWrapper/cuiWrapper.cpp
src/plugin/spiLibrary/spiLibrary.cpp
src/plugin/xpiLibrary/xpiLibrary.cpp

index 1aad071..fa6c5ad 100644 (file)
@@ -35,6 +35,7 @@
     <ul>\r
      <li class="add">TPI_INFO_HANDLE_ON_COMMANDを追加。</li>\r
      <li class="chg">Command()に書庫のハンドルを渡せるよう変更。</li>\r
+     <li class="chg">TPI内部でライブラリのパスをハードコーディングしないよう変更。</li>\r
     </ul>\r
    </dd>\r
    <dt>Lychee</dt>\r
index 7060a85..540f723 100644 (file)
@@ -60,3 +60,33 @@ inline wxDateTime FileTimeToWxDateTime(FILETIME * pft)
        return dt;\r
 }\r
 #endif\r
+\r
+#ifdef MYUSE_LIBPATH\r
+wxString g_szLibPath;\r
+\r
+wxString inline myMakeXMLName(const wxString & szFile)\r
+{\r
+       return g_szLibPath + szFile + wxT(".xml");\r
+}\r
+\r
+#ifdef __WINDOWS__\r
+BOOL WINAPI DllMain(HINSTANCE hLib, DWORD dwReason, void *)\r
+{\r
+       if (dwReason == DLL_PROCESS_ATTACH)\r
+       {\r
+               wchar_t szName[1024];\r
+               ::GetModuleFileName(hLib, szName, sizeof(szName) - 1);\r
+               g_szLibPath = wxFileName::wxFileName(WC2String(szName)).GetPath(true);\r
+       }\r
+       return TRUE;\r
+}\r
+#else\r
+#include <dlfcn.h>\r
+__attribute__((constructor)) void on_load(void)\r
+{\r
+       Dl_info dl;\r
+       dladdr((void *) on_load, & dl);\r
+       g_szLibPath = wxFileName(UTF82String(dl.dli_fname)).GetPath(true);\r
+}\r
+#endif\r
+#endif\r
index 4427a02..ed0f3b8 100644 (file)
@@ -25,7 +25,6 @@
 \r
 #include "../header/plugin.h"\r
 #include <wx/xml/xml.h>\r
-#include <wx/stdpaths.h>\r
 #ifndef WXWIN_COMPATIBILITY_2_8\r
 #define GetAttribute GetPropVal\r
 #define HasAttribute HasProp\r
@@ -42,40 +41,3 @@ wxXmlNode * myGetNextLib(wxXmlNode * n, int nLibIndex = 0);
 wxULongLong_t myGetAttributeInt( wxXmlNode * n, const wxString & szValue, wxULongLong_t nDefaultValue = 0, int nBase = 10);\r
 bool myGetAttributeBool(wxXmlNode * n, const wxString & szValue, bool bDefaultValue = false);\r
 void MakeFormatInfo(wxXmlNode * n, const wxString & szTPIName, TPI_FORMATINFO * _fiInfo, wxULongLong_t nId);\r
-\r
-wxString inline myMakeXMLName(const wxString & szFile)\r
-{\r
-       return wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) + wxT("/lib/") + szFile + wxT(".xml");\r
-}\r
-\r
-#ifdef MYUSE_CONFIG\r
-wxString g_szLibPath;\r
-\r
-wxString inline myMakeXMLName(const wxString & szFile)\r
-{\r
-       return g_szLibPath + szFile + wxT(".xml");\r
-}\r
-\r
-#ifdef __WINDOWS__\r
-BOOL WINAPI DllMain(HINSTANCE hLib, DWORD dwReason, void *)\r
-{\r
-       if (dwReason == DLL_PROCESS_ATTACH)\r
-       {\r
-               wchar_t szName[1024];\r
-               ::GetModuleFileName(hLib, szName, sizeof(szName) - 1);\r
-               g_szLibPath = wxFileName::wxFileName(WC2String(szName)).GetPath(true);\r
-       }\r
-       return TRUE;\r
-}\r
-#else\r
-#define _GNU_SOURCE\r
-#include <dlfcn.h>\r
-\r
-__attribute__((constructor)) void on_load(void)\r
-{\r
-       Dl_info dl;\r
-       dladdr(on_load, & dl);\r
-       g_szLibPath = wxFileName::wxFileName(UTF82String(dl.dli_fname)).GetPath(true);\r
-}\r
-#endif\r
-#endif\r
index 5e42e01..0a6c6b2 100644 (file)
@@ -24,6 +24,7 @@
 //******************************************************************************\r
 \r
 #define wxUSE_DYNLIB_CLASS 1\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
index 1d5f68c..f6a90c5 100644 (file)
 //    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
 #include "../../common/library/xmldoc.h"\r
 #include <wx/dynlib.h>\r
 #include <wx/config.h>\r
-#include <wx/stdpaths.h>\r
 #include <wx/xml/xml.h>\r
 #include <windows.h>\r
 #include "calLibrary.h"\r
index 2ab763d..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
index 8e088ea..efcd6f0 100644 (file)
 //    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
 #include <wx/file.h>\r
-#include <wx/stdpaths.h>\r
 #include <wx/dir.h>\r
 #include <windows.h>\r
 #include "spiLibrary.h"\r
@@ -140,14 +140,14 @@ int __stdcall LoadPlugin
                }\r
        }\r
 \r
-       wxString szSPIPath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) + wxT("/lib/"), szSPIName;\r
-       wxDir fs(szSPIPath);\r
+       wxString szSPIName;\r
+       wxDir fs(g_szLibPath);\r
        if (fs.GetFirst(& szSPIName, wxT("*.spi")))\r
        {\r
                do\r
                {\r
                        // SPIをロード。\r
-                       g_hLib = ::LoadLibrary((szSPIPath + szSPIName).wchar_str());\r
+                       g_hLib = ::LoadLibrary((g_szLibPath + szSPIName).wchar_str());\r
                        if (g_hLib == NULL)\r
                        {\r
                                continue;\r
index 7efc46f..3fde702 100644 (file)
 //    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
 #include <wx/file.h>\r
-#include <wx/stdpaths.h>\r
 #include <wx/dir.h>\r
 #include <windows.h>\r
 #include "xpiLibrary.h"\r
@@ -145,14 +145,14 @@ int __stdcall LoadPlugin
                }\r
        }\r
 \r
-       wxString szSPIPath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) + wxT("/lib/"), szSPIName;\r
-       wxDir fs(szSPIPath);\r
+       wxString szSPIName;\r
+       wxDir fs(g_szLibPath);\r
        if (fs.GetFirst(& szSPIName, wxT("*.spi")))\r
        {\r
                do\r
                {\r
                        // SPIをロード。\r
-                       g_hLib = ::LoadLibrary((szSPIPath + szSPIName).wchar_str());\r
+                       g_hLib = ::LoadLibrary((g_szLibPath + szSPIName).wchar_str());\r
                        if (g_hLib == NULL)\r
                        {\r
                                continue;\r
@@ -228,13 +228,12 @@ int __stdcall GetFileInformation
        bool _bFirst\r
 )\r
 {\r
-       static wxString szXPIPath, szXPIName, szArcName = * (wxString *) _hArchive;\r
+       static wxString szXPIName, szArcName = * (wxString *) _hArchive;\r
        static int nColorDepth;\r
        static wxDir fs;\r
        if (_bFirst)\r
        {\r
-               szXPIPath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) + wxT("/lib/");\r
-               fs.Open(szXPIPath);\r
+               fs.Open(g_szLibPath);\r
 \r
                // 画像の情報を取得。\r
                FARPROC fpProc = ::GetProcAddress(g_hLib, "GetPictureInfo");\r
@@ -258,7 +257,7 @@ int __stdcall GetFileInformation
                do\r
                {\r
                        // XPIをロード。\r
-                       HMODULE hXPI = ::LoadLibrary((szXPIPath + szXPIName).wchar_str());\r
+                       HMODULE hXPI = ::LoadLibrary((g_szLibPath + szXPIName).wchar_str());\r
                        if (hXPI == NULL)\r
                        {\r
                                continue;\r
@@ -405,7 +404,6 @@ int __stdcall Command
                return nErrorCode;\r
        }\r
 \r
-       wxString szXPIPath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) + wxT("/lib/");\r
        for (size_t i = 0; i < _asFiles.GetCount(); i++)\r
        {\r
                // 処理を行うか確認。\r
@@ -425,7 +423,7 @@ int __stdcall Command
                }\r
 \r
                // XPIをロード。\r
-               HMODULE hXPI = ::LoadLibrary((szXPIPath + piInfo.fiInfo.fnFileName.GetPath()).wchar_str());\r
+               HMODULE hXPI = ::LoadLibrary((g_szLibPath + piInfo.fiInfo.fnFileName.GetPath()).wchar_str());\r
                if (hXPI == NULL)\r
                {\r
                        nErrorCode = TPI_ERROR_U_USE_LIBRARY;\r