Add translations & Improve code quality

This commit is contained in:
Jack251970 2025-09-22 20:55:36 +08:00
parent bfd10f6903
commit 71b8144c3c
2 changed files with 6 additions and 7 deletions

View file

@ -590,6 +590,7 @@
<system:String x:Key="errorTitle">Error</system:String>
<system:String x:Key="folderOpenError">An error occurred while opening the folder. {0}</system:String>
<system:String x:Key="browserOpenError">An error occurred while opening the URL in the browser. Please check your Default Web Browser configuration in the General section of the settings window</system:String>
<system:String x:Key="fileNotFoundError">File or directory not found: {0}</system:String>
<!-- General Notice -->
<system:String x:Key="pleaseWait">Please wait...</system:String>

View file

@ -1,4 +1,4 @@
using System;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Specialized;
@ -412,14 +412,12 @@ namespace Flow.Launcher
private void OpenUri(Uri uri, bool? inPrivate = null, bool forceBrowser = false)
{
if (uri.IsFile)
if (uri.IsFile && !File.Exists(uri.LocalPath) && !Directory.Exists(uri.LocalPath))
{
if (!File.Exists(uri.LocalPath) && !Directory.Exists(uri.LocalPath))
{
ShowMsgError(GetTranslation("errorTitle"), $"File or directory not found: {uri.LocalPath}");
return;
}
ShowMsgError(GetTranslation("errorTitle"), string.Format(GetTranslation("fileNotFoundError"), uri.LocalPath));
return;
}
if (forceBrowser || uri.Scheme == Uri.UriSchemeHttp || uri.Scheme == Uri.UriSchemeHttps)
{
var browserInfo = _settings.CustomBrowser;