FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
cefpython/patches/issue231.patch at cefpython147 · cztomczak/cefpython · GitHub
cztomczak
/
cefpython
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
477
Star
3.2k
Code
Issues
223
Pull requests
4
Actions
Wiki
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Wiki
Security and quality
Insights
Expand file tree
Breadcrumbs
cefpython
/
patches
/
issue231.patch
Copy path
More file actions
More file actions
Latest commit
History
History
History
140 lines (133 loc) · 4.45 KB
Breadcrumbs
cefpython
/
patches
/
issue231.patch
Copy path
File metadata and controls
140 lines (133 loc) · 4.45 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
diff --git include/capi/cef_path_util_capi.h include/capi/cef_path_util_capi.h
index de99ebd8..dd2f21c5 100644
--- include/capi/cef_path_util_capi.h
+++ include/capi/cef_path_util_capi.h
@@ -51,6 +51,16 @@
extern "C" {
///
CEF_EXPORT int cef_get_path(cef_path_key_t key, cef_string_t* path);
+
///
+
// Override the path associated with the specified |key|. This cannot be used to
+
// change the value of PK_DIR_CURRENT, but that should be obvious. Also, if the
+
// path specifies a directory that does not exist, the directory will be created
+
// by this function. This function returns true (1) if successful. WARNING:
+
// Consumers of CefGetPath may expect paths to be constant over the lifetime of
+
// the app, so this function should be used with caution.
+
///
+
CEF_EXPORT int cef_override_path(cef_path_key_t key, const cef_string_t* path);
+
#ifdef __cplusplus
}
#endif
diff --git include/cef_path_util.h include/cef_path_util.h
index 552f4ba5..95af66ef 100644
--- include/cef_path_util.h
+++ include/cef_path_util.h
@@ -49,4 +49,15 @@
typedef cef_path_key_t PathKey;
/*--cef()--*/
bool CefGetPath(PathKey key, CefString& path);
+
///
+
// Override the path associated with the specified |key|. This cannot
+
// be used to change the value of PK_DIR_CURRENT, but that should be obvious.
+
// Also, if the path specifies a directory that does not exist, the directory
+
// will be created by this method. This method returns true if successful.
+
// WARNING: Consumers of CefGetPath may expect paths to be constant
+
// over the lifetime of the app, so this method should be used with caution.
+
///
+
/*--cef()--*/
+
bool CefOverridePath(PathKey key, const CefString& path);
+
#endif // CEF_INCLUDE_CEF_PATH_UTIL_H_
diff --git libcef/browser/path_util_impl.cc libcef/browser/path_util_impl.cc
index 6a759309..ad620d7f 100644
--- libcef/browser/path_util_impl.cc
+++ libcef/browser/path_util_impl.cc
@@ -51,3 +51,38 @@
bool CefGetPath(PathKey key, CefString& path) {
return false;
}
+
+
bool CefOverridePath(PathKey key, const CefString& path) {
+
int pref_key = base::PATH_START;
+
switch(key) {
+
case PK_DIR_EXE:
+
pref_key = base::DIR_EXE;
+
break;
+
case PK_DIR_MODULE:
+
pref_key = base::DIR_MODULE;
+
break;
+
case PK_DIR_TEMP:
+
pref_key = base::DIR_TEMP;
+
break;
+
case PK_FILE_EXE:
+
pref_key = base::FILE_EXE;
+
break;
+
case PK_FILE_MODULE:
+
pref_key = base::FILE_MODULE;
+
break;
+
#if defined(OS_WIN)
+
case PK_LOCAL_APP_DATA:
+
pref_key = base::DIR_LOCAL_APP_DATA;
+
break;
+
#endif
+
case PK_USER_DATA:
+
pref_key = chrome::DIR_USER_DATA;
+
break;
+
default:
+
NOTREACHED() << "invalid argument";
+
return false;
+
}
+
+
base::FilePath file_path = base::FilePath(path);
+
return PathService::Override(pref_key, file_path);
+
}
diff --git libcef_dll/libcef_dll.cc libcef_dll/libcef_dll.cc
index 096eede2..05ecf9bd 100644
--- libcef_dll/libcef_dll.cc
+++ libcef_dll/libcef_dll.cc
@@ -959,6 +959,23 @@
CEF_EXPORT int cef_get_path(cef_path_key_t key, cef_string_t* path) {
return _retval;
}
+
CEF_EXPORT int cef_override_path(cef_path_key_t key, const cef_string_t* path) {
+
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
+
+
// Verify param: path; type: string_byref_const
+
DCHECK(path);
+
if (!path)
+
return 0;
+
+
// Execute
+
bool _retval = CefOverridePath(
+
key,
+
CefString(path));
+
+
// Return type: bool
+
return _retval;
+
}
+
CEF_EXPORT int cef_launch_process(struct _cef_command_line_t* command_line) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
diff --git libcef_dll/wrapper/libcef_dll_wrapper.cc libcef_dll/wrapper/libcef_dll_wrapper.cc
index 15026ab5..a3d21052 100644
--- libcef_dll/wrapper/libcef_dll_wrapper.cc
+++ libcef_dll/wrapper/libcef_dll_wrapper.cc
@@ -880,6 +880,23 @@
CEF_GLOBAL bool CefGetPath(PathKey key, CefString& path) {
return _retval ? true : false;
}
+
CEF_GLOBAL bool CefOverridePath(PathKey key, const CefString& path) {
+
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
+
+
// Verify param: path; type: string_byref_const
+
DCHECK(!path.empty());
+
if (path.empty())
+
return false;
+
+
// Execute
+
int _retval = cef_override_path(
+
key,
+
path.GetStruct());
+
+
// Return type: bool
+
return _retval?true:false;
+
}
+
CEF_GLOBAL bool CefLaunchProcess(CefRefPtr<CefCommandLine> command_line) {
// AUTO-GENERATED CONTENT - DELETE THIS COMMENT BEFORE MODIFYING
Back
|
FazBrowse Home
|
New Git URL