From fa1f646d193feaa5dcf858475d3011ef1c610532 Mon Sep 17 00:00:00 2001 From: Michael Stewart Date: Thu, 16 Aug 2018 15:48:59 -0700 Subject: [PATCH] better fix for conditionally compiling the docs --- crates/notion-core/src/path/windows.rs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/crates/notion-core/src/path/windows.rs b/crates/notion-core/src/path/windows.rs index 090935502..9aab57275 100644 --- a/crates/notion-core/src/path/windows.rs +++ b/crates/notion-core/src/path/windows.rs @@ -2,8 +2,8 @@ //! in a standard Notion layout in Windows operating systems. use std::path::PathBuf; -// using std::os instead of std::os::windows because that was causing `cargo doc --features universal-docs` to fail -use std::os; +#[cfg(windows)] +use std::os::windows; use std::io; use winfolder; @@ -49,6 +49,7 @@ fn program_data_root() -> Fallible { #[cfg(windows)] return Ok(winfolder::Folder::ProgramData.path().join("Notion")); + // "universal-docs" is built on a Unix machine, so we can't include Windows-specific libs #[cfg(feature = "universal-docs")] unimplemented!() } @@ -117,6 +118,7 @@ fn program_files_root() -> Fallible { #[cfg(windows)] return Ok(winfolder::Folder::ProgramFilesX64.path().join("Notion")); + // "universal-docs" is built on a Unix machine, so we can't include Windows-specific libs #[cfg(feature = "universal-docs")] unimplemented!() } @@ -146,6 +148,7 @@ fn local_data_root() -> Fallible { #[cfg(windows)] return Ok(winfolder::Folder::LocalAppData.path().join("Notion")); + // "universal-docs" is built on a Unix machine, so we can't include Windows-specific libs #[cfg(feature = "universal-docs")] unimplemented!() } @@ -159,5 +162,10 @@ pub fn user_catalog_file() -> Fallible { } pub fn create_file_symlink(src: PathBuf, dst: PathBuf) -> Result<(), io::Error> { - os::windows::fs::symlink_file(src, dst) + #[cfg(windows)] + return windows::fs::symlink_file(src, dst); + + // "universal-docs" is built on a Unix machine, so we can't include Windows-specific libs + #[cfg(feature = "universal-docs")] + unimplemented!() }