Unnamed repository; edit this file 'description' to name the repository.
Diffstat (limited to 'helix-loader/src/lib.rs')
| -rw-r--r-- | helix-loader/src/lib.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/helix-loader/src/lib.rs b/helix-loader/src/lib.rs index 54980dd7..9872b77a 100644 --- a/helix-loader/src/lib.rs +++ b/helix-loader/src/lib.rs @@ -244,7 +244,12 @@ pub fn merge_toml_values(left: toml::Value, right: toml::Value, merge_depth: usi /// Otherwise (workspace, false) is returned pub fn find_workspace() -> (PathBuf, bool) { let current_dir = current_working_dir(); - for ancestor in current_dir.ancestors() { + find_workspace_in(current_dir) +} + +pub fn find_workspace_in(dir: impl AsRef<Path>) -> (PathBuf, bool) { + let dir = dir.as_ref(); + for ancestor in dir.ancestors() { if ancestor.join(".git").exists() || ancestor.join(".svn").exists() || ancestor.join(".jj").exists() @@ -254,7 +259,7 @@ pub fn find_workspace() -> (PathBuf, bool) { } } - (current_dir, true) + (dir.to_owned(), true) } fn default_config_file() -> PathBuf { |