Repository: alacritty/alacritty (language: rust)

Issue:
alacritty migrate: Configuration file migration failed: parsing error: Unable to locate config file
Fresh after upgrading to alacritty 0.13.0, I saw in the release notes that there's been a migration from yaml to toml. I ran `alacritty migrate` as instructed, but it failed with:
```
Configuration file migration failed:
    "/home/user/.config/alacritty/alacritty.yml": parsing error: Unable to locate config file
```
Obviously, the file is there. There is a parsing error, but the exact cause seems to be misreported.

After playing with it a bit, I found that running `alacritty migrate -i` (skipping imports) succeeds. The only import in my yaml was `colorscheme.yml`. To be honest, I don't remember what exactly that is, but I've decided to create this issue, because `Unable to locate config file` is misleading and maybe this will help other people.

It's unfortunate that `migrate` fails with a vague error on a [former valid config](https://github.com/Randoragon/dotfiles/blob/b45d7534595d6e3cc6550d616294f8e5bb4c49a4/alacritty/.config/alacritty/alacritty.yml). I don't mean this to come off as picky though, thanks for taking the effort of making this migration smooth!

### System

OS: Arch Linux, X11, bspwm, picom
Version: alacritty 0.13.0 (78fa4d6f)


Discussion / hints:
yeah, it should likely tell which file it failed to locate correctly.
> It's unfortunate that migrate fails with a vague error on a former valid config.

Just to be 100% clear, this is still a valid configuration file and there's no plan to change that. Missing imports is an intentionally supported feature. Seems like migration just doesn't account for that, it should be a warning instead.

Fix patch:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 0534c103b97..e65f85f382c 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
 
 ## 0.14.0-dev
 
+### Fixed
+
+- `alacritty migrate` failing with nonexistent imports
+
 ## 0.13.0
 
 ### Packaging
diff --git a/alacritty/src/migrate.rs b/alacritty/src/migrate.rs
index 4d632af4619..5f47b08313a 100644
--- a/alacritty/src/migrate.rs
+++ b/alacritty/src/migrate.rs
@@ -96,7 +96,7 @@ fn migrate_config(
     if options.dry_run && !options.silent {
         // Output new content to STDOUT.
         println!(
-            "\nv-----Start TOML for {path:?}-----v\n\n{toml}\n^-----End TOML for {path:?}-----^"
+            "\nv-----Start TOML for {path:?}-----v\n\n{toml}\n^-----End TOML for {path:?}-----^\n"
         );
     } else if !options.dry_run {
         // Write the new toml configuration.
@@ -124,7 +124,23 @@ fn migrate_imports(
             Ok(import) => import,
             Err(err) => return Err(format!("import error: {err}")),
         };
+
+        // Keep yaml import if path does not exist.
+        if !import.exists() {
+            if options.dry_run {
+                eprintln!("Keeping yaml config for nonexistent import: {import:?}");
+            }
+            new_imports.push(Value::String(import.to_string_lossy().into()));
+            continue;
+        }
+
         let new_path = migrate_config(options, &import, recursion_limit - 1)?;
+
+        // Print new import path.
+        if options.dry_run {
+            println!("Successfully migrated import {import:?} to {new_path:?}");
+        }
+
         new_imports.push(Value::String(new_path));
     }
 


Test patch: