-
Notifications
You must be signed in to change notification settings - Fork 3
Use preset path directly if it exists #44
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -75,8 +75,14 @@ fn ask_confirmation(prompt: &str) -> bool { | |||||||||||||||||||||||||||||||||||||||
| } | ||||||||||||||||||||||||||||||||||||||||
|
|
||||||||||||||||||||||||||||||||||||||||
| fn run_load_preset(preset_name: &str, no_confirm: bool, current_dir: &Path) -> Result<(), Error> { | ||||||||||||||||||||||||||||||||||||||||
| // Load the preset file from the `presets/` directory. | ||||||||||||||||||||||||||||||||||||||||
| let preset_path = PathBuf::from("presets").join(format!("{preset_name}.toml")); | ||||||||||||||||||||||||||||||||||||||||
| // Load the file, or get it from the `presets/` directory | ||||||||||||||||||||||||||||||||||||||||
| let pb = PathBuf::from(preset_name); | ||||||||||||||||||||||||||||||||||||||||
| let preset_path = if pb.is_file() { | ||||||||||||||||||||||||||||||||||||||||
| pb | ||||||||||||||||||||||||||||||||||||||||
| } else { | ||||||||||||||||||||||||||||||||||||||||
| PathBuf::from("presets").join(format!("{preset_name}.toml")) | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+78
to
+83
|
||||||||||||||||||||||||||||||||||||||||
| }; | ||||||||||||||||||||||||||||||||||||||||
|
Comment on lines
+79
to
+84
|
||||||||||||||||||||||||||||||||||||||||
| let pb = PathBuf::from(preset_name); | |
| let preset_path = if pb.is_file() { | |
| pb | |
| } else { | |
| PathBuf::from("presets").join(format!("{preset_name}.toml")) | |
| }; | |
| // Resolve the preset path relative to `current_dir` (the `--root`), unless `preset_name` is absolute. | |
| let candidate = if Path::new(preset_name).is_absolute() { | |
| PathBuf::from(preset_name) | |
| } else { | |
| current_dir.join(preset_name) | |
| }; | |
| let preset_path = if candidate.is_file() { | |
| candidate | |
| } else { | |
| current_dir | |
| .join("presets") | |
| .join(format!("{preset_name}.toml")) | |
| }; |
Uh oh!
There was an error while loading. Please reload this page.