Skip to content
Permalink
Browse files

Adapted to comply to Notepad++'s standard locations for a plug-in, it…

…s configuration file and its support files.

i.e.
    Notepad++
    \--- plugins
         |    XMLTools.dll
         +--- Config
         |       XMLToolsExt.ini
         \--- XMLTools
                 libcurl.dll
                 libiconv-2.dll
                 etc.
  • Loading branch information...
MAPJe71 committed Aug 14, 2016
1 parent 7fca0fb commit 3b266ec4933bab03dfd84b70f905e6ff69f931c2
Showing with 227 additions and 182 deletions.
  1. +26 −15 LoadLibrary.cpp
  2. +1 −1 OptionsDlg.cpp
  3. +168 −138 XMLTools.cpp
  4. +2 −0 XMLTools.sln
  5. +27 −25 XMLTools.vcxproj
  6. +3 −3 XMLTools.vcxproj.user
@@ -77,8 +77,8 @@ int (*pXmlKeepBlanksDefault)(int val);
int (*pXmlThrDefIndentTreeOutput)(int v);
const char * (*pXmlThrDefTreeIndentString)(const char * v);

void (*pXmlNanoHTTPInit)(void);
void (*pXmlNanoHTTPScanProxy)(const char * URL);
void (*pXmlNanoHTTPInit)(void);
void (*pXmlNanoHTTPScanProxy)(const char * URL);
const char * (*pXmlNanoHTTPAuthHeader)(void *ctx);


@@ -96,21 +96,32 @@ xsltTransformContextPtr(*pXsltNewTransformContext)(xsltStylesheetPtr style, xmlD
//-------------------------------------------------------------------------------------------------

HINSTANCE loadExtLib(const wchar_t* libFilename, const wchar_t* nppMainPath, const wchar_t* appDataPath) {
wchar_t pszPath[MAX_PATH] = { '\0' };
HINSTANCE res = LoadLibrary(libFilename);
wchar_t pszPath[MAX_PATH] = { '\0' };

// try loading from NPP plugins path (standard NPP location)
Report::strcpy(pszPath, nppMainPath);
PathAppend(pszPath, L"plugins\\XMLTools\\");
PathAppend(pszPath, libFilename);
HINSTANCE res = LoadLibrary(pszPath);

if (res == NULL) {
// try loading from main npp path
Report::strcpy(pszPath, nppMainPath);
PathAppend(pszPath, L"\\XMLTools\\");
// try loading from %appdata% path (standard NPP UAC/AppData location)
Report::strcpy(pszPath, appDataPath);
PathAppend(pszPath, L"Notepad++\\");
PathAppend(pszPath, libFilename);
res = LoadLibrary(pszPath);
res = LoadLibrary(pszPath);

// try loading from %appdata% path
if (res == NULL) {
Report::strcpy(pszPath, appDataPath);
PathAppend(pszPath, L"\\Notepad++\\");
// try loading from NPP sub path
Report::strcpy(pszPath, nppMainPath);
PathAppend(pszPath, L"XMLTools\\");
PathAppend(pszPath, libFilename);
res = LoadLibrary(pszPath);

if (res == NULL) {
// try loading (from NPP main path)
res = LoadLibrary(libFilename);
}
}
}
return res;
@@ -121,18 +132,18 @@ int loadLibraries(wchar_t* nppMainPath, wchar_t* appDataPath) {
HKEY hKey = NULL;
DWORD size = MAX_PATH;

// loading dependances
// loading dependencies
if (loadExtLib(L"libiconv-2.dll", nppMainPath, appDataPath) == NULL) return -1;
if (loadExtLib(L"zlib1.dll", nppMainPath, appDataPath) == NULL) return -1;
if (loadExtLib(L"libwinpthread-1.dll", nppMainPath, appDataPath) == NULL) return -1;

// loading libxml
// loading LIBXML
hInstLibXML = loadExtLib(L"libxml2-2.dll", nppMainPath, appDataPath);
if (hInstLibXML == NULL) {
return -1;
}

// loading libxslt
// loading LIBXSLT
hInstLibXSL = loadExtLib(L"libxslt-1.dll", nppMainPath, appDataPath);
if (hInstLibXSL == NULL) {
return -1;
@@ -221,7 +232,7 @@ int loadLibraries(wchar_t* nppMainPath, wchar_t* appDataPath) {
}

/*
xmlNodePtr pXmlRemoveNs(xmlNodePtr tree,xmlNsPtr ns) {
xmlNodePtr pXmlRemoveNs(xmlNodePtr tree, xmlNsPtr ns) {
xmlNsPtr nsDef,prev;
xmlNodePtr node = tree;
xmlNodePtr declNode = NULL;
@@ -52,7 +52,7 @@ BOOL COptionsDlg::OnInitDialog()
((CButton*) GetDlgItem(IDC_CHKENABLEPROXY))->SetCheck(BST_UNCHECKED);
}
GetDlgItem(IDC_EDITPROXYHOST)->SetWindowTextW(this->proxyoptions->host);
GetDlgItem(IDC_EDITPROXYPORT)->SetWindowTextW(std::to_wstring(this->proxyoptions->port).c_str());
GetDlgItem(IDC_EDITPROXYPORT)->SetWindowTextW(std::to_wstring(static_cast<long long>(this->proxyoptions->port)).c_str());
//GetDlgItem(IDC_EDITPROXYUSERNAME)->SetWindowTextW(this->proxyoptions->username);
//GetDlgItem(IDC_EDITPROXYPASSWORD)->SetWindowTextW(this->proxyoptions->password);
}

0 comments on commit 3b266ec

Please sign in to comment.
You can’t perform that action at this time.