summaryrefslogtreecommitdiffhomepage
path: root/mullvad-problem-report/src/lib.rs
diff options
context:
space:
mode:
authorEmīls <emils@mullvad.net>2020-04-28 12:27:28 +0100
committerEmīls <emils@mullvad.net>2020-04-28 12:30:42 +0100
commit03029aedbc33bb1ddbda6f545f771aeb092e9bd0 (patch)
tree13668f25f374dac5574caaac9c513a70e4279c8f /mullvad-problem-report/src/lib.rs
parente1a1f1206cf7f7dfc7220c2d8c4abad36b6620d0 (diff)
downloadmullvadvpn-03029aedbc33bb1ddbda6f545f771aeb092e9bd0.tar.xz
mullvadvpn-03029aedbc33bb1ddbda6f545f771aeb092e9bd0.zip
Pass resource directory to problem report
Diffstat (limited to 'mullvad-problem-report/src/lib.rs')
-rw-r--r--mullvad-problem-report/src/lib.rs22
1 files changed, 18 insertions, 4 deletions
diff --git a/mullvad-problem-report/src/lib.rs b/mullvad-problem-report/src/lib.rs
index cf37e6cb0f..eaeafbbf85 100644
--- a/mullvad-problem-report/src/lib.rs
+++ b/mullvad-problem-report/src/lib.rs
@@ -251,6 +251,22 @@ pub fn send_problem_report(
user_email: &str,
user_message: &str,
report_path: &Path,
+ #[cfg(target_os = "android")] resource_dir: &Path,
+) -> Result<(), Error> {
+ #[cfg(not(target_os = "android"))]
+ let ca_path = mullvad_paths::resources::get_api_ca_path();
+
+ #[cfg(target_os = "android")]
+ let ca_path = resource_dir.join(mullvad_paths::resources::API_CA_FILENAME);
+
+ send_problem_report_inner(user_email, user_message, report_path, &ca_path)
+}
+
+pub fn send_problem_report_inner(
+ user_email: &str,
+ user_message: &str,
+ report_path: &Path,
+ ca_path: &Path,
) -> Result<(), Error> {
let report_content = normalize_newlines(
read_file_lossy(report_path, REPORT_MAX_SIZE).map_err(|source| {
@@ -263,10 +279,8 @@ pub fn send_problem_report(
let metadata =
ProblemReport::parse_metadata(&report_content).unwrap_or_else(|| metadata::collect());
- let ca_path = mullvad_paths::resources::get_api_ca_path();
-
- let mut rpc_manager = mullvad_rpc::MullvadRpcRuntime::new(ca_path.as_ref())
- .map_err(Error::CreateRpcClientError)?;
+ let mut rpc_manager =
+ mullvad_rpc::MullvadRpcRuntime::new(ca_path).map_err(Error::CreateRpcClientError)?;
let rpc_client = mullvad_rpc::ProblemReportProxy::new(rpc_manager.mullvad_rest_handle());
rpc_client