1 /*******************************************************************************
\r
2 TPI - flexible but useless plug-in framework.
\r
3 Copyright (C) 2002-2009 Silky
\r
5 This library is free software; you can redistribute it and/or modify it under
\r
6 the terms of the GNU Lesser General Public License as published by the Free
\r
7 Software Foundation; either version 2.1 of the License, or (at your option)
\r
10 This library is distributed in the hope that it will be useful, but WITHOUT
\r
11 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
\r
12 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
\r
15 You should have received a copy of the GNU Lesser General Public License along
\r
16 with this library; if not, write to the Free Software Foundation, Inc.,
\r
17 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
\r
20 *******************************************************************************/
\r
22 //******************************************************************************
\r
24 //******************************************************************************
\r
26 #include "../header/plugin.h"
\r
27 #include <wx/file.h>
\r
29 //******************************************************************************
\r
31 //******************************************************************************
\r
33 wxString MakeCommandLineSend(const wxString & szCommandLine, TPI_SWITCHES * swInfo = NULL, const wxArrayString & asFiles = wxArrayString(), const wxString & szResponceFileName = wxEmptyString);
\r
34 wxString MakeResponceFile(const wxArrayString & asFiles, bool bQuote, bool bUnicode = false);
\r
35 wxString MB2String(const char * sz);
\r
36 wxString UTF82String(const char * sz);
\r
37 wxString WC2String(const wchar_t * sz);
\r
39 inline void RemoveCwdFromSearchPath(void)
\r
42 static void * p = (void *) ::GetProcAddress(::GetModuleHandleW(L"kernel32.dll"), "SetDllDirectoryW");
\r
45 ((int (__stdcall *)(const wchar_t *)) p)(L"");
\r
51 inline wxDateTime FileTimeToWxDateTime(FILETIME * pft)
\r
55 if (! ::FileTimeToLocalFileTime(pft, & ftLocal) || ! ::FileTimeToSystemTime(& ftLocal, & st))
\r
59 wxDateTime dt(st.wDay, wxDateTime::Month(st.wMonth - 1), st.wYear, st.wHour, st.wMinute, st.wSecond, st.wMilliseconds);
\r
64 #ifdef MYUSE_LIBPATH
\r
65 wxString g_szLibPath;
\r
68 BOOL WINAPI DllMain(HINSTANCE hLib, DWORD dwReason, void *)
\r
70 if (dwReason == DLL_PROCESS_ATTACH)
\r
72 wchar_t szName[1024];
\r
73 ::GetModuleFileName(hLib, szName, sizeof(szName) - 1);
\r
74 g_szLibPath = wxFileName(WC2String(szName)).GetPath(true);
\r
80 // GCC4.7ではg_szLibPathへの代入で不正終了してしまうので、myMakeXMLNameの初回に呼ぶように変更。
\r
81 //__attribute__((constructor))
\r
82 void inline on_load(void)
\r
85 dladdr((void *) on_load, & dl);
\r
86 g_szLibPath = wxFileName(UTF82String(dl.dli_fname)).GetPath(true);
\r
90 wxString myMakeXMLName(const wxString & szFile)
\r
93 if (g_szLibPath.IsEmpty())
\r
95 // 初回はライブラリが存在するディレクトリを取得。
\r
99 return g_szLibPath + szFile + wxT(".xml");
\r