Skip to content

Commit

Permalink
Merge pull request rust-lang#10 from lzutao/ci/add-mac-winnt-builds
Browse files Browse the repository at this point in the history
ci: Add Mac and Windows builds
  • Loading branch information
tesuji authored Aug 16, 2019
2 parents 2c718c9 + e658ff7 commit 865e4b9
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 6 deletions.
31 changes: 30 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,32 @@
dist: xenial
language: rust
rust:
- stable
- stable

git:
depth: 1
quiet: true

matrix:
fast_finish: true
include:
- os: linux
env: TARGET=x86_64-unknown-linux-gnu

- os: osx
osx_image: xcode9.2
env: MACOSX_DEPLOYMENT_TARGET=10.7 TARGET=x86_64-apple-darwin

- os: windows
env: TARGET=x86_64-pc-windows-msvc EXE_EXT=.exe
services: nil

- name: rustfmt
install:
- rustup component add rustfmt
script:
- cargo fmt --all -- --check

script:
- cargo build --verbose
- cargo test --verbose
9 changes: 4 additions & 5 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
//! [rust-lang/rust#43321]: https://github.com/rust-lang/rust/issues/43321
#![deny(rust_2018_idioms)]
#![allow(deprecated)] // uses std::env::home_dir when necessary
#![allow(deprecated)] // uses env::home_dir when necessary

use std::env;
use std::io;
Expand Down Expand Up @@ -68,7 +68,6 @@ pub fn home_dir() -> Option<PathBuf> {

#[cfg(windows)]
fn home_dir_() -> Option<PathBuf> {
use scopeguard;
use std::ptr;
use winapi::shared::winerror::ERROR_INSUFFICIENT_BUFFER;
use winapi::um::errhandlingapi::GetLastError;
Expand All @@ -77,7 +76,7 @@ fn home_dir_() -> Option<PathBuf> {
use winapi::um::userenv::GetUserProfileDirectoryW;
use winapi::um::winnt::TOKEN_READ;

std::env::var_os("USERPROFILE")
env::var_os("USERPROFILE")
.map(PathBuf::from)
.or_else(|| unsafe {
let me = GetCurrentProcess();
Expand Down Expand Up @@ -162,7 +161,7 @@ where

#[cfg(any(unix, target_os = "redox"))]
fn home_dir_() -> Option<PathBuf> {
std::env::home_dir()
env::home_dir()
}

/// Returns the storage directory used by Cargo, often knowns as
Expand Down Expand Up @@ -217,7 +216,7 @@ pub fn cargo_home_with_cwd(cwd: &Path) -> io::Result<PathBuf> {
let user_home = home_dir.map(|p| p.join(".cargo"));

// Compatibility with old cargo that used the std definition of home_dir
let compat_home_dir = std::env::home_dir();
let compat_home_dir = env::home_dir();
let compat_user_home = compat_home_dir.map(|p| p.join(".cargo"));

if let Some(p) = env_cargo_home {
Expand Down

0 comments on commit 865e4b9

Please sign in to comment.