summary history branches tags files
commit:47bb77ffbaf3cfe380d9f1b699ea50bea21d81f5
author:Trevor Bentley
committer:Trevor Bentley
date:Wed Feb 13 20:37:57 2019 +0100
parents:aec55f557f04c198d8d762a3e5ac73f3bf736873
Clean up warnings
diff --git a/Cargo.toml b/Cargo.toml
line changes: +1/-0
index 09900a3..90a715f
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -17,6 +17,7 @@ dummy = []
 [dependencies]
 time = "0.1"
 log = {version = "0.4", optional = true }
+dirs = "1.0.4"
 
 [dependencies.log4rs]
 version = "0.8"

diff --git a/examples/register_url.rs b/examples/register_url.rs
line changes: +0/-1
index 9af714f..7a135d8
--- a/examples/register_url.rs
+++ b/examples/register_url.rs
@@ -19,7 +19,6 @@ use fruitbasket::InstallDir;
 use fruitbasket::RunPeriod;
 use fruitbasket::FruitError;
 use fruitbasket::FruitCallbackKey;
-use std::time::Duration;
 use std::path::PathBuf;
 
 #[macro_use]

diff --git a/src/lib.rs b/src/lib.rs
line changes: +2/-1
index 69aff76..8b83a75
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -45,6 +45,7 @@ use std::sync::mpsc::Receiver;
 use std::thread;
 
 extern crate time;
+extern crate dirs;
 
 #[cfg(all(target_os = "macos", not(feature="dummy")))]
 #[macro_use]
@@ -364,7 +365,7 @@ pub fn create_logger(filename: &str,
     use self::log4rs::config::{Appender, Config, Logger, Root};
 
     let log_path = match dir {
-        LogDir::Home => format!("{}/{}", std::env::home_dir().unwrap().display(), filename),
+        LogDir::Home => format!("{}/{}", dirs::home_dir().unwrap().display(), filename),
         LogDir::Temp => format!("{}/{}", std::env::temp_dir().display(), filename),
         LogDir::Custom(s) => format!("{}/{}", s, filename),
     };

diff --git a/src/osx.rs b/src/osx.rs
line changes: +8/-1
index 4786f29..3148af3
--- a/src/osx.rs
+++ b/src/osx.rs
@@ -34,6 +34,11 @@
 //! If uncertain, use a `Trampoline`.  You can hit very strange behavior when running
 //! Cocoa apps outside of an app bundle.
 #![deny(missing_docs)]
+
+// Temporarily (mmmmhmm...) disable deprecated function warnings, because objc macros
+// throw tons of them in rustc 1.34-nightly when initializing atomic uints.
+#![allow(deprecated)]
+
 use std;
 use std::thread;
 use std::time::Duration;
@@ -56,6 +61,8 @@ use super::FORBIDDEN_PLIST;
 
 extern crate time;
 
+extern crate dirs;
+
 extern crate objc;
 use objc::runtime::Object;
 use objc::runtime::Class;
@@ -424,7 +431,7 @@ impl Trampoline {
             let install_dir: PathBuf = match dir {
                 InstallDir::Temp => std::env::temp_dir(),
                 InstallDir::SystemApplications => PathBuf::from("/Applications/"),
-                InstallDir::UserApplications => std::env::home_dir().unwrap().join("Applications/"),
+                InstallDir::UserApplications => dirs::home_dir().unwrap().join("Applications/"),
                 InstallDir::Custom(dir) => std::fs::canonicalize(PathBuf::from(dir))?,
             };
             info!("Install dir: {:?}", install_dir);