aboutsummaryrefslogtreecommitdiff
path: root/helix-term/src/main.rs
diff options
context:
space:
mode:
authorBjorn Ove Hay Andersen2023-11-21 11:07:00 +0000
committerGitHub2023-11-21 11:07:00 +0000
commit47b6c4bc78d449e3586f28d26507bfc8fb8608e2 (patch)
tree3ad3f593efed0b27ed68cb20b95f8a34881552de /helix-term/src/main.rs
parent3052050ee0388207048318fed0909e63a2c865f9 (diff)
Resolve args.files before changing directory (#8676)
* Resolve args.files before changing directory * Removed the open_cwd work-around now that the path is full * If -w is specified, use that as the working directory * Open the remaining files in the argument list, also when the first is a directory * Use an iterator access the files argument
Diffstat (limited to 'helix-term/src/main.rs')
-rw-r--r--helix-term/src/main.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs
index 6411a7c5..a62c54a4 100644
--- a/helix-term/src/main.rs
+++ b/helix-term/src/main.rs
@@ -116,16 +116,18 @@ FLAGS:
setup_logging(args.verbosity).context("failed to initialize logging")?;
+ // Before setting the working directory, resolve all the paths in args.files
+ for (path, _) in args.files.iter_mut() {
+ *path = helix_core::path::get_canonicalized_path(path);
+ }
+
// NOTE: Set the working directory early so the correct configuration is loaded. Be aware that
// Application::new() depends on this logic so it must be updated if this changes.
if let Some(path) = &args.working_directory {
helix_loader::set_current_working_dir(path)?;
- }
-
- // If the first file is a directory, it will be the working directory and a file picker will be opened
- if let Some((path, _)) = args.files.first().filter(|p| p.0.is_dir()) {
+ } else if let Some((path, _)) = args.files.first().filter(|p| p.0.is_dir()) {
+ // If the first file is a directory, it will be the working directory unless -w was specified
helix_loader::set_current_working_dir(path)?;
- args.open_cwd = true; // Signal Application that we want to open the picker on "."
}
let config = match Config::load_default() {