mirror of
https://github.com/lune-org/lune.git
synced 2025-04-04 10:30:54 +01:00
Recognize ./scripts as a script directory
This commit is contained in:
parent
95c2ca0965
commit
7f03296e78
2 changed files with 8 additions and 3 deletions
|
@ -127,10 +127,11 @@ pub fn discover_script_path(path: impl AsRef<str>, in_home_dir: bool) -> Result<
|
|||
|
||||
/**
|
||||
Discovers a script file path based on a given script name, and tries to
|
||||
find scripts in `lune` and `.lune` folders if one was not directly found.
|
||||
find scripts in `lune`, `.lune` and `scripts` folders if one was not
|
||||
directly found.
|
||||
|
||||
Note that looking in `lune` and `.lune` folders is automatically
|
||||
disabled if the given script name is an absolute path.
|
||||
Note that looking in `lune`, `scripts` and `.lune` folders is
|
||||
automatically disabled if the given script name is an absolute path.
|
||||
|
||||
Behavior is otherwise exactly the same as for `discover_script_file_path`.
|
||||
*/
|
||||
|
@ -148,6 +149,7 @@ pub fn discover_script_path_including_lune_dirs(path: &str) -> Result<PathBuf> {
|
|||
// directories + the home directory for the current user
|
||||
let res = discover_script_path(format!("lune{MAIN_SEPARATOR}{path}"), false)
|
||||
.or_else(|_| discover_script_path(format!(".lune{MAIN_SEPARATOR}{path}"), false))
|
||||
.or_else(|_| discover_script_path(format!("scripts{MAIN_SEPARATOR}{path}"), false))
|
||||
.or_else(|_| discover_script_path(format!("lune{MAIN_SEPARATOR}{path}"), true))
|
||||
.or_else(|_| discover_script_path(format!(".lune{MAIN_SEPARATOR}{path}"), true));
|
||||
|
||||
|
|
|
@ -23,6 +23,9 @@ pub async fn find_lune_scripts(in_home_dir: bool) -> Result<Vec<(String, String)
|
|||
if lune_dir.is_err() {
|
||||
lune_dir = fs::read_dir(base_path.join(".lune")).await;
|
||||
}
|
||||
if lune_dir.is_err() && !in_home_dir {
|
||||
lune_dir = fs::read_dir(base_path.join("scripts")).await;
|
||||
}
|
||||
match lune_dir {
|
||||
Ok(mut dir) => {
|
||||
let mut files = Vec::new();
|
||||
|
|
Loading…
Add table
Reference in a new issue