OLD | NEW |
1 #include "PluginStdAfx.h" | 1 #include "PluginStdAfx.h" |
2 #include <algorithm> | 2 #include <algorithm> |
3 #include <stdexcept> | 3 #include <stdexcept> |
4 #include <vector> | 4 #include <vector> |
5 | 5 |
6 #include "../shared/Utils.h" | 6 #include "../shared/Utils.h" |
7 #include "PluginUtil.h" | 7 #include "PluginUtil.h" |
8 #include "PluginSettings.h" | 8 #include "PluginSettings.h" |
9 | 9 |
10 std::wstring HtmlFolderPath() | 10 std::wstring HtmlFolderPath() |
(...skipping 10 matching lines...) Expand all Loading... |
21 { | 21 { |
22 return FileUrl(HtmlFolderPath() + L"firstRun.html"); | 22 return FileUrl(HtmlFolderPath() + L"firstRun.html"); |
23 } | 23 } |
24 | 24 |
25 std::wstring FileUrl(const std::wstring& path) | 25 std::wstring FileUrl(const std::wstring& path) |
26 { | 26 { |
27 std::wstring url = path; | 27 std::wstring url = path; |
28 std::replace(url.begin(), url.end(), L'\\', L'/'); | 28 std::replace(url.begin(), url.end(), L'\\', L'/'); |
29 return L"file:///" + url; | 29 return L"file:///" + url; |
30 } | 30 } |
| 31 |
| 32 bool EntryPoint(const std::function<void()>& functionBody) |
| 33 { |
| 34 bool withoutException = true; |
| 35 if (!functionBody) |
| 36 { |
| 37 return withoutException; |
| 38 } |
| 39 try |
| 40 { |
| 41 functionBody(); |
| 42 } catch(...) |
| 43 { |
| 44 withoutException = false; |
| 45 } |
| 46 return withoutException; |
| 47 } |
| 48 |
| 49 HRESULT EntryPointWithHResult(const std::function<HRESULT()>& functionBody) |
| 50 { |
| 51 HRESULT retValue = S_OK; |
| 52 if (!functionBody) |
| 53 { |
| 54 return retValue; |
| 55 } |
| 56 try |
| 57 { |
| 58 functionBody(); |
| 59 } catch(...) |
| 60 { |
| 61 retValue = E_FAIL; |
| 62 } |
| 63 return retValue; |
| 64 } |
| 65 |
OLD | NEW |