-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow checker to support reparsepoints in Windows #23
Conversation
On Linux,
use std::process::Command;
#[cfg(target_os="windows")]
static PATHS: [&str; 2] = [
r"C:\Users\jpallant\AppData\Local\Microsoft\WindowsApps\winget.exe",
r"C:\Python38\Python.exe",
];
#[cfg(target_os="linux")]
static PATHS: [&str; 2] = [
r"/usr/bin/xzcat",
r"/usr/bin/xz",
];
fn main() {
for path in &PATHS {
println!("Meta for {:?}:\n{:#?}", path, std::fs::metadata(path));
println!(
"Symlink Meta for {:?}:\n{:#?}",
path,
std::fs::symlink_metadata(path)
);
let output = Command::new(path)
.arg("--version")
.output()
.expect("Failed to execute command");
println!("Got {:?}", output);
}
} |
Does that mean we should use different |
Yeah I can't see a way around that at the moment. Windows' concept of symlinks is quite different to POSIX OSes like Linux and macOS. |
ok, @jonathanpallant. Thanks for testing. @harryfei , how does this look? impl Checker for ExistedChecker {
#[cfg(target_os="windows")]
fn is_valid(&self, path: &Path) -> bool {
fs::symlink_metadata(path)
.map(|metadata| metadata.is_file())
.unwrap_or(false)
}
#[cfg(not(target_os="windows"))]
fn is_valid(&self, path: &Path) -> bool {
fs::metadata(path)
.map(|metadata| metadata.is_file())
.unwrap_or(false)
}
} |
@harryfei Any idea what this CI error means? |
CI is glitchy here. Not sure what needs to happen to get this merged. @harryfei can you help please? |
So odd. I can merge it without passing all the CI jobs. |
@harryfei Deleted the |
src/checker.rs
Outdated
@@ -23,7 +23,7 @@ impl Checker for ExecutableChecker { | |||
.and_then(|c| Ok(unsafe { libc::access(c.as_ptr(), libc::X_OK) == 0 })) | |||
.unwrap_or(false) | |||
} | |||
|
|||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unexpected spaces.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you saying you don't want these spaces or i should remove the line entirely? I removed the spaces.
No description provided.