OLD | NEW |
1 /* | 1 /* |
2 * This file is part of Adblock Plus <https://adblockplus.org/>, | 2 * This file is part of Adblock Plus <https://adblockplus.org/>, |
3 * Copyright (C) 2006-2015 Eyeo GmbH | 3 * Copyright (C) 2006-2015 Eyeo GmbH |
4 * | 4 * |
5 * Adblock Plus is free software: you can redistribute it and/or modify | 5 * Adblock Plus is free software: you can redistribute it and/or modify |
6 * it under the terms of the GNU General Public License version 3 as | 6 * it under the terms of the GNU General Public License version 3 as |
7 * published by the Free Software Foundation. | 7 * published by the Free Software Foundation. |
8 * | 8 * |
9 * Adblock Plus is distributed in the hope that it will be useful, | 9 * Adblock Plus is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 27 matching lines...) Expand all Loading... |
38 { | 38 { |
39 return FileUrl(HtmlFolderPath() + L"firstRun.html"); | 39 return FileUrl(HtmlFolderPath() + L"firstRun.html"); |
40 } | 40 } |
41 | 41 |
42 std::wstring FileUrl(const std::wstring& path) | 42 std::wstring FileUrl(const std::wstring& path) |
43 { | 43 { |
44 std::wstring url = path; | 44 std::wstring url = path; |
45 std::replace(url.begin(), url.end(), L'\\', L'/'); | 45 std::replace(url.begin(), url.end(), L'\\', L'/'); |
46 return L"file:///" + url; | 46 return L"file:///" + url; |
47 } | 47 } |
| 48 |
| 49 bool EntryPoint(const std::function<void()>& functionBody) |
| 50 { |
| 51 bool withoutException = true; |
| 52 if (!functionBody) |
| 53 { |
| 54 return withoutException; |
| 55 } |
| 56 try |
| 57 { |
| 58 functionBody(); |
| 59 } catch(...) |
| 60 { |
| 61 withoutException = false; |
| 62 } |
| 63 return withoutException; |
| 64 } |
| 65 |
| 66 HRESULT EntryPointWithHResult(const std::function<HRESULT()>& functionBody) |
| 67 { |
| 68 HRESULT retValue = S_OK; |
| 69 if (!functionBody) |
| 70 { |
| 71 return retValue; |
| 72 } |
| 73 try |
| 74 { |
| 75 functionBody(); |
| 76 } catch(...) |
| 77 { |
| 78 retValue = E_FAIL; |
| 79 } |
| 80 return retValue; |
| 81 } |
| 82 |
OLD | NEW |