forked from extern/nushell
dot character is valid in Windows plugin binaries.
This commit is contained in:
parent
c57c0eb371
commit
e4ed8c94ad
27
src/cli.rs
27
src/cli.rs
@ -138,15 +138,7 @@ fn load_plugins(context: &mut Context) -> Result<(), ShellError> {
|
|||||||
for path in search_paths() {
|
for path in search_paths() {
|
||||||
let mut pattern = path.to_path_buf();
|
let mut pattern = path.to_path_buf();
|
||||||
|
|
||||||
#[cfg(windows)]
|
|
||||||
{
|
|
||||||
pattern.push(std::path::Path::new("nu_plugin_[a-z]*.[a-z]*"));
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
|
||||||
{
|
|
||||||
pattern.push(std::path::Path::new("nu_plugin_[a-z]*"));
|
pattern.push(std::path::Path::new("nu_plugin_[a-z]*"));
|
||||||
}
|
|
||||||
|
|
||||||
match glob::glob_with(&pattern.to_string_lossy(), opts) {
|
match glob::glob_with(&pattern.to_string_lossy(), opts) {
|
||||||
Err(_) => {}
|
Err(_) => {}
|
||||||
@ -167,15 +159,26 @@ fn load_plugins(context: &mut Context) -> Result<(), ShellError> {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
let is_valid_name = bin_name
|
let is_valid_name = {
|
||||||
|
#[cfg(windows)]
|
||||||
|
{
|
||||||
|
bin_name
|
||||||
.chars()
|
.chars()
|
||||||
.all(|c| c.is_ascii_alphabetic() || c == '_');
|
.all(|c| c.is_ascii_alphabetic() || c == '_' || c == '.')
|
||||||
|
}
|
||||||
|
|
||||||
|
#[cfg(not(windows))]
|
||||||
|
{
|
||||||
|
bin_name
|
||||||
|
.chars()
|
||||||
|
.all(|c| c.is_ascii_alphabetic() || c == '_')
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
let is_executable = {
|
let is_executable = {
|
||||||
#[cfg(windows)]
|
#[cfg(windows)]
|
||||||
{
|
{
|
||||||
bin.ends_with(std::path::Path::new(".exe"))
|
bin_name.ends_with(".exe") || bin_name.ends_with(".bat")
|
||||||
|| bin.ends_with(std::path::Path::new(".bat"))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(not(windows))]
|
#[cfg(not(windows))]
|
||||||
|
Loading…
Reference in New Issue
Block a user