Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Side by Side Diff: src/plugin/PluginUtil.cpp

Issue 6032593782833152: Issue 1173 - proposal for entry point (Closed)
Patch Set: Created Jan. 13, 2015, 11:40 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/plugin/PluginUtil.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
OLDNEW
« no previous file with comments | « src/plugin/PluginUtil.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld