From 0361a0d3bf4cd44dc7437362e86d6c76cae83665 Mon Sep 17 00:00:00 2001 From: Claude Code Date: Mon, 22 Sep 2025 14:22:16 -0700 Subject: [PATCH] feat: Improve error messages for config and cache directory creation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Provide clear, contextual error messages when GitUI fails to create config or cache directories due to permission issues or other filesystem errors. Instead of showing a generic 'Permission denied (os error 13)', users now see exactly which directory GitUI was trying to create. Before: - Error: Permission denied (os error 13) After: - Failed to create config directory: /home/user/.config/gitui Error: Permission denied (os error 13) - Failed to create cache directory: /home/user/.cache/gitui Error: Permission denied (os error 13) This makes it much easier for users to identify and resolve permission issues with their configuration directories. Fixes #2683 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude --- src/args.rs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/args.rs b/src/args.rs index 4c1a64ec92..c82c47c994 100644 --- a/src/args.rs +++ b/src/args.rs @@ -49,7 +49,13 @@ pub fn process_cmdline() -> Result { .map_or_else(|| PathBuf::from("theme.ron"), PathBuf::from); let confpath = get_app_config_path()?; - fs::create_dir_all(&confpath)?; + fs::create_dir_all(&confpath).map_err(|e| { + anyhow!( + "Failed to create config directory: {}\nError: {}", + confpath.display(), + e + ) + })?; let theme = confpath.join(arg_theme); let notify_watcher: bool = @@ -154,7 +160,13 @@ fn get_app_cache_path() -> Result { .ok_or_else(|| anyhow!("failed to find os cache dir."))?; path.push("gitui"); - fs::create_dir_all(&path)?; + fs::create_dir_all(&path).map_err(|e| { + anyhow!( + "Failed to create cache directory: {}\nError: {}", + path.display(), + e + ) + })?; Ok(path) }