Mercurial > hg > vamp-plugin-load-checker
comparison src/helper.cpp @ 18:7eff522b23ae
More useful reporting output
author | Chris Cannam |
---|---|
date | Tue, 01 Nov 2016 15:09:44 +0000 |
parents | 78baaad4a001 |
children | 65b6c64992dd |
comparison
equal
deleted
inserted
replaced
17:78baaad4a001 | 18:7eff522b23ae |
---|---|
59 #ifdef _WIN32 | 59 #ifdef _WIN32 |
60 #include <windows.h> | 60 #include <windows.h> |
61 #include <process.h> | 61 #include <process.h> |
62 #include <string> | 62 #include <string> |
63 #ifdef UNICODE | 63 #ifdef UNICODE |
64 static std::string lastLibraryName = ""; | |
64 static HMODULE LoadLibraryUTF8(std::string name) { | 65 static HMODULE LoadLibraryUTF8(std::string name) { |
66 lastLibraryName = name; | |
65 int n = name.size(); | 67 int n = name.size(); |
66 int wn = MultiByteToWideChar(CP_UTF8, 0, name.c_str(), n, 0, 0); | 68 int wn = MultiByteToWideChar(CP_UTF8, 0, name.c_str(), n, 0, 0); |
67 wchar_t *wname = new wchar_t[wn+1]; | 69 wchar_t *wname = new wchar_t[wn+1]; |
68 wn = MultiByteToWideChar(CP_UTF8, 0, name.c_str(), n, wname, wn); | 70 wn = MultiByteToWideChar(CP_UTF8, 0, name.c_str(), n, wname, wn); |
69 wname[wn] = L'\0'; | 71 wname[wn] = L'\0'; |
98 for (int i = s.size(); i > 0; ) { | 100 for (int i = s.size(); i > 0; ) { |
99 --i; | 101 --i; |
100 if (s[i] == '\n' || s[i] == '\r') { | 102 if (s[i] == '\n' || s[i] == '\r') { |
101 s.erase(i, 1); | 103 s.erase(i, 1); |
102 } | 104 } |
105 } | |
106 std::size_t pos = s.find("%1"); | |
107 if (pos != std::string::npos && lastLibraryName != "") { | |
108 s.replace(pos, 2, lastLibraryName); | |
103 } | 109 } |
104 return s; | 110 return s; |
105 } | 111 } |
106 #define DLOPEN(a,b) LoadLibraryUTF8(a) | 112 #define DLOPEN(a,b) LoadLibraryUTF8(a) |
107 #else | 113 #else |