@@ -279,16 +279,16 @@ where
279279pub fn install_directory ( ) -> PathBuf {
280280 let install_dir_ptr: * mut c_char = unsafe { BNGetInstallDirectory ( ) } ;
281281 assert ! ( !install_dir_ptr. is_null( ) ) ;
282- let bn_install_dir = unsafe { BnString :: from_raw ( install_dir_ptr) } ;
283- PathBuf :: from ( bn_install_dir . to_string ( ) )
282+ let install_dir_str = unsafe { BnString :: into_string ( install_dir_ptr) } ;
283+ PathBuf :: from ( install_dir_str )
284284}
285285
286286pub fn bundled_plugin_directory ( ) -> Result < PathBuf , ( ) > {
287287 let s: * mut c_char = unsafe { BNGetBundledPluginDirectory ( ) } ;
288288 if s. is_null ( ) {
289289 return Err ( ( ) ) ;
290290 }
291- Ok ( PathBuf :: from ( unsafe { BnString :: from_raw ( s) } . to_string ( ) ) )
291+ Ok ( PathBuf :: from ( unsafe { BnString :: into_string ( s) } ) )
292292}
293293
294294pub fn set_bundled_plugin_directory ( new_dir : impl AsRef < Path > ) {
@@ -299,31 +299,33 @@ pub fn set_bundled_plugin_directory(new_dir: impl AsRef<Path>) {
299299pub fn user_directory ( ) -> PathBuf {
300300 let user_dir_ptr: * mut c_char = unsafe { BNGetUserDirectory ( ) } ;
301301 assert ! ( !user_dir_ptr. is_null( ) ) ;
302- let bn_user_dir = unsafe { BnString :: from_raw ( user_dir_ptr) } ;
303- PathBuf :: from ( bn_user_dir . to_string ( ) )
302+ let user_dir_str = unsafe { BnString :: into_string ( user_dir_ptr) } ;
303+ PathBuf :: from ( user_dir_str )
304304}
305305
306306pub fn user_plugin_directory ( ) -> Result < PathBuf , ( ) > {
307307 let s: * mut c_char = unsafe { BNGetUserPluginDirectory ( ) } ;
308308 if s. is_null ( ) {
309309 return Err ( ( ) ) ;
310310 }
311- Ok ( PathBuf :: from ( unsafe { BnString :: from_raw ( s) } . to_string ( ) ) )
311+ let user_plugin_dir_str = unsafe { BnString :: into_string ( s) } ;
312+ Ok ( PathBuf :: from ( user_plugin_dir_str) )
312313}
313314
314315pub fn repositories_directory ( ) -> Result < PathBuf , ( ) > {
315316 let s: * mut c_char = unsafe { BNGetRepositoriesDirectory ( ) } ;
316317 if s. is_null ( ) {
317318 return Err ( ( ) ) ;
318319 }
319- Ok ( PathBuf :: from ( unsafe { BnString :: from_raw ( s) } . to_string ( ) ) )
320+ let repo_dir_str = unsafe { BnString :: into_string ( s) } ;
321+ Ok ( PathBuf :: from ( repo_dir_str) )
320322}
321323
322- pub fn settings_file_name ( ) -> PathBuf {
324+ pub fn settings_file_path ( ) -> PathBuf {
323325 let settings_file_name_ptr: * mut c_char = unsafe { BNGetSettingsFileName ( ) } ;
324326 assert ! ( !settings_file_name_ptr. is_null( ) ) ;
325- let bn_settings_file_name = unsafe { BnString :: from_raw ( settings_file_name_ptr) } ;
326- PathBuf :: from ( bn_settings_file_name . to_string ( ) )
327+ let settings_file_path_str = unsafe { BnString :: into_string ( settings_file_name_ptr) } ;
328+ PathBuf :: from ( settings_file_path_str )
327329}
328330
329331/// Write the installation directory of the currently running core instance to disk.
@@ -340,7 +342,7 @@ pub fn path_relative_to_bundled_plugin_directory(path: impl AsRef<Path>) -> Resu
340342 if s. is_null ( ) {
341343 return Err ( ( ) ) ;
342344 }
343- Ok ( PathBuf :: from ( unsafe { BnString :: from_raw ( s) } . to_string ( ) ) )
345+ Ok ( PathBuf :: from ( unsafe { BnString :: into_string ( s) } ) )
344346}
345347
346348pub fn path_relative_to_user_plugin_directory ( path : impl AsRef < Path > ) -> Result < PathBuf , ( ) > {
@@ -350,7 +352,7 @@ pub fn path_relative_to_user_plugin_directory(path: impl AsRef<Path>) -> Result<
350352 if s. is_null ( ) {
351353 return Err ( ( ) ) ;
352354 }
353- Ok ( PathBuf :: from ( unsafe { BnString :: from_raw ( s) } . to_string ( ) ) )
355+ Ok ( PathBuf :: from ( unsafe { BnString :: into_string ( s) } ) )
354356}
355357
356358pub fn path_relative_to_user_directory ( path : impl AsRef < Path > ) -> Result < PathBuf , ( ) > {
@@ -360,7 +362,7 @@ pub fn path_relative_to_user_directory(path: impl AsRef<Path>) -> Result<PathBuf
360362 if s. is_null ( ) {
361363 return Err ( ( ) ) ;
362364 }
363- Ok ( PathBuf :: from ( unsafe { BnString :: from_raw ( s) } . to_string ( ) ) )
365+ Ok ( PathBuf :: from ( unsafe { BnString :: into_string ( s) } ) )
364366}
365367
366368/// Returns if the running thread is the "main thread"
@@ -476,7 +478,7 @@ impl VersionInfo {
476478 }
477479
478480 pub ( crate ) fn free_raw ( value : BNVersionInfo ) {
479- let _ = unsafe { BnString :: from_raw ( value. channel ) } ;
481+ unsafe { BnString :: free_raw ( value. channel ) } ;
480482 }
481483
482484 pub fn from_string < S : BnStrCompatible > ( string : S ) -> Self {
0 commit comments