From 522445d0794d42a4019c4ce27be731fe4e34083f Mon Sep 17 00:00:00 2001 From: Dzmitry Malyshau Date: Fri, 16 Feb 2018 11:33:40 -0500 Subject: [PATCH] Entry LIB_PATH --- ash/src/entry.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/ash/src/entry.rs b/ash/src/entry.rs index 74c686f..a663932 100644 --- a/ash/src/entry.rs +++ b/ash/src/entry.rs @@ -4,34 +4,26 @@ use std::ptr; use vk; use instance::Instance; use shared_library::dynamic_library::DynamicLibrary; -use std::path::Path; use std::error::Error; use std::fmt; +use std::path::Path; use RawPtr; use version::{EntryLoader, FunctionPointers, InstanceLoader, V1_0}; #[cfg(windows)] -fn get_path() -> &'static Path { - Path::new("vulkan-1.dll") -} +const LIB_PATH: &'static str = "vulkan-1.dll"; #[cfg(all(unix, not(any(target_os = "macos", target_os = "ios", target_os = "android"))))] -fn get_path() -> &'static Path { - Path::new("libvulkan.so.1") -} +const LIB_PATH: &'static str = "libvulkan.so.1"; #[cfg(target_os = "android")] -fn get_path() -> &'static Path { - Path::new("libvulkan.so") -} +const LIB_PATH: &'static str = "libvulkan.so"; #[cfg(any(target_os = "macos", target_os = "ios"))] -fn get_path() -> &'static Path { - Path::new("libMoltenVK.dylib") -} +const LIB_PATH: &'static str = "libMoltenVK.dylib"; lazy_static!{ - static ref VK_LIB: Result = DynamicLibrary::open(Some(get_path())); + static ref VK_LIB: Result = DynamicLibrary::open(Some(&Path::new(LIB_PATH))); } #[derive(Clone)] @@ -165,7 +157,7 @@ impl Entry { .map_err(|err| LoadingError::LibraryLoadError(err.clone()))?; let static_fn = vk::StaticFn::load(|name| unsafe { - lib.symbol(name.to_str().unwrap()) + lib.symbol(&*name.to_string_lossy()) .unwrap_or(ptr::null_mut()) }).map_err(LoadingError::StaticLoadError)?;