mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Improve error handling
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
parent
9fa4c37109
commit
001101bb81
1 changed files with 13 additions and 2 deletions
|
|
@ -59,8 +59,19 @@ namespace Flow.Launcher.Infrastructure.UserSettings
|
|||
if (Path.IsPathRooted(path))
|
||||
return path;
|
||||
|
||||
// Resolve relative to ProgramDirectory
|
||||
return Path.GetFullPath(Path.Combine(Constant.ProgramDirectory, path));
|
||||
// Resolve relative to ProgramDirectory, handling invalid path formats gracefully
|
||||
try
|
||||
{
|
||||
return Path.GetFullPath(Path.Combine(Constant.ProgramDirectory, path));
|
||||
}
|
||||
catch (Exception ex) when (ex is ArgumentException ||
|
||||
ex is NotSupportedException ||
|
||||
ex is PathTooLongException)
|
||||
{
|
||||
// If the path cannot be resolved (invalid characters, format, or too long),
|
||||
// return the original path to avoid crashing the application.
|
||||
return path;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue