summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOdd Stranne <odd@mullvad.net>2018-01-19 12:20:20 +0000
committerOdd Stranne <odd@mullvad.net>2018-01-19 12:20:20 +0000
commit257a5e1e1a0f5a996840c19aeaab1856f805c3fc (patch)
tree7a38bc13dbda6cc4f267ba6b05d6d06cf39ace03
parent1e9ea182530217becbf99c645d3929c6fe9c55db (diff)
parent7580e644f891c4171848c467ddf76cfa317088e8 (diff)
downloadmullvadvpn-257a5e1e1a0f5a996840c19aeaab1856f805c3fc.tar.xz
mullvadvpn-257a5e1e1a0f5a996840c19aeaab1856f805c3fc.zip
Merge branch 'win-fix-filenames'
-rw-r--r--talpid-core/src/tunnel/mod.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/talpid-core/src/tunnel/mod.rs b/talpid-core/src/tunnel/mod.rs
index f5c3618352..747115564e 100644
--- a/talpid-core/src/tunnel/mod.rs
+++ b/talpid-core/src/tunnel/mod.rs
@@ -177,7 +177,11 @@ impl TunnelMonitor {
}
fn get_openvpn_bin(resource_dir: &Path) -> OsString {
- let bin = OsStr::new("openvpn");
+ let bin = if cfg!(windows) {
+ OsStr::new("openvpn.exe")
+ } else {
+ OsStr::new("openvpn")
+ };
let bundled_path = resource_dir.join("openvpn-binaries").join(bin);
if bundled_path.exists() {
bundled_path.into_os_string()
@@ -188,8 +192,8 @@ impl TunnelMonitor {
}
fn get_plugin_path(resource_dir: &Path) -> Result<PathBuf> {
- let lib_ext = Self::get_library_extension().chain_err(|| ErrorKind::PluginNotFound)?;
- let path = resource_dir.join(format!("libtalpid_openvpn_plugin.{}", lib_ext));
+ let library = Self::get_library_name().chain_err(|| ErrorKind::PluginNotFound)?;
+ let path = resource_dir.join(library);
if path.exists() {
debug!("Using OpenVPN plugin at {}", path.to_string_lossy());
@@ -199,13 +203,13 @@ impl TunnelMonitor {
}
}
- fn get_library_extension() -> Result<&'static str> {
+ fn get_library_name() -> Result<&'static str> {
if cfg!(target_os = "macos") {
- Ok("dylib")
+ Ok("libtalpid_openvpn_plugin.dylib")
} else if cfg!(unix) {
- Ok("so")
+ Ok("libtalpid_openvpn_plugin.so")
} else if cfg!(windows) {
- Ok("dll")
+ Ok("talpid_openvpn_plugin.dll")
} else {
bail!(ErrorKind::UnsupportedPlatform);
}