mirror of
https://github.com/BurntSushi/ripgrep.git
synced 2025-08-10 00:52:04 -07:00
fix windows build
Why isn't CI running on each push? It seems to only be running on tagged commits.
This commit is contained in:
@@ -9,7 +9,9 @@ use grep::{Grep, GrepBuilder};
|
|||||||
use log;
|
use log;
|
||||||
use num_cpus;
|
use num_cpus;
|
||||||
use regex;
|
use regex;
|
||||||
use term::{self, Terminal};
|
use term::Terminal;
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
use term;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use term::WinConsole;
|
use term::WinConsole;
|
||||||
use walkdir::WalkDir;
|
use walkdir::WalkDir;
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
use std::io::{self, Write};
|
use std::io::{self, Write};
|
||||||
|
|
||||||
use term::{self, Terminal};
|
use term::{self, Terminal};
|
||||||
|
#[cfg(not(windows))]
|
||||||
use term::terminfo::TermInfo;
|
use term::terminfo::TermInfo;
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
use term::WinConsole;
|
use term::WinConsole;
|
||||||
|
@@ -11,14 +11,12 @@ improvement on just listing the files to search (!).
|
|||||||
use std::ffi::OsStr;
|
use std::ffi::OsStr;
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
|
|
||||||
use memchr::memrchr;
|
|
||||||
|
|
||||||
/// Strip `prefix` from the `path` and return the remainder.
|
/// Strip `prefix` from the `path` and return the remainder.
|
||||||
///
|
///
|
||||||
/// If `path` doesn't have a prefix `prefix`, then return `None`.
|
/// If `path` doesn't have a prefix `prefix`, then return `None`.
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
pub fn strip_prefix<'a, P: AsRef<Path>>(
|
pub fn strip_prefix<'a, P: AsRef<Path> + ?Sized>(
|
||||||
prefix: P,
|
prefix: &'a P,
|
||||||
path: &'a Path,
|
path: &'a Path,
|
||||||
) -> Option<&'a Path> {
|
) -> Option<&'a Path> {
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
@@ -36,7 +34,10 @@ pub fn strip_prefix<'a, P: AsRef<Path>>(
|
|||||||
///
|
///
|
||||||
/// If `path` doesn't have a prefix `prefix`, then return `None`.
|
/// If `path` doesn't have a prefix `prefix`, then return `None`.
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
pub fn strip_prefix<'a>(prefix: &Path, path: &'a Path) -> Option<&'a Path> {
|
pub fn strip_prefix<'a, P: AsRef<Path> + ?Sized>(
|
||||||
|
prefix: &'a P,
|
||||||
|
path: &'a Path,
|
||||||
|
) -> Option<&'a Path> {
|
||||||
path.strip_prefix(prefix).ok()
|
path.strip_prefix(prefix).ok()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -49,6 +50,7 @@ pub fn file_name<'a, P: AsRef<Path> + ?Sized>(
|
|||||||
path: &'a P,
|
path: &'a P,
|
||||||
) -> Option<&'a OsStr> {
|
) -> Option<&'a OsStr> {
|
||||||
use std::os::unix::ffi::OsStrExt;
|
use std::os::unix::ffi::OsStrExt;
|
||||||
|
use memchr::memrchr;
|
||||||
|
|
||||||
let path = path.as_ref().as_os_str().as_bytes();
|
let path = path.as_ref().as_os_str().as_bytes();
|
||||||
if path.is_empty() {
|
if path.is_empty() {
|
||||||
@@ -90,7 +92,7 @@ pub fn is_hidden<P: AsRef<Path>>(path: P) -> bool {
|
|||||||
/// Returns true if and only if this file path is considered to be hidden.
|
/// Returns true if and only if this file path is considered to be hidden.
|
||||||
#[cfg(not(unix))]
|
#[cfg(not(unix))]
|
||||||
pub fn is_hidden<P: AsRef<Path>>(path: P) -> bool {
|
pub fn is_hidden<P: AsRef<Path>>(path: P) -> bool {
|
||||||
if let Some(name) = file_name(path) {
|
if let Some(name) = file_name(path.as_ref()) {
|
||||||
name.to_str().map(|s| s.starts_with(".")).unwrap_or(false)
|
name.to_str().map(|s| s.starts_with(".")).unwrap_or(false)
|
||||||
} else {
|
} else {
|
||||||
false
|
false
|
||||||
|
Reference in New Issue
Block a user