diff --git a/HMCL/src/main/java/org/jackhuang/hmcl/setting/DownloadProviders.java b/HMCL/src/main/java/org/jackhuang/hmcl/setting/DownloadProviders.java index 591af18dd..54cd170cb 100644 --- a/HMCL/src/main/java/org/jackhuang/hmcl/setting/DownloadProviders.java +++ b/HMCL/src/main/java/org/jackhuang/hmcl/setting/DownloadProviders.java @@ -29,6 +29,7 @@ import org.jackhuang.hmcl.util.io.ResponseCodeException; import java.io.FileNotFoundException; import java.net.SocketTimeoutException; import java.net.URL; +import java.nio.file.AccessDeniedException; import java.util.Arrays; import java.util.Map; import java.util.Optional; @@ -150,6 +151,8 @@ public final class DownloadProviders { } } else if (exception.getCause() instanceof FileNotFoundException) { return i18n("download.code.404", url); + } else if (exception.getCause() instanceof AccessDeniedException) { + return i18n("install.failed.downloading.access_denied", url, ((AccessDeniedException) exception.getCause()).getFile()); } else { return i18n("install.failed.downloading.detail", url) + "\n" + StringUtils.getStackTrace(exception.getCause()); } diff --git a/HMCL/src/main/resources/assets/lang/I18N.properties b/HMCL/src/main/resources/assets/lang/I18N.properties index ed3d48696..f55f1c8cd 100644 --- a/HMCL/src/main/resources/assets/lang/I18N.properties +++ b/HMCL/src/main/resources/assets/lang/I18N.properties @@ -392,6 +392,7 @@ install.change_version=Change version install.change_version.confirm=Are you sure you want to update %s from verison %s to %s? install.failed=Version failed to install install.failed.downloading=Failed to install due to some files not downloaded successfully +install.failed.downloading.access_denied=Failed to download file: %1$s. Because it's denied by operating system to access file %2$s. Maybe we don't have permission to access this file, or this file has already been opened by other program. You can try to close related program, or restart your computer. install.failed.downloading.detail=Failed to download file: %s install.failed.downloading.timeout=Timed out while downloading the file: %s install.failed.install_online=Unable to recognize the provided installer file. If you are installing a mod, go to "Mods" page. diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh.properties b/HMCL/src/main/resources/assets/lang/I18N_zh.properties index c8df235d1..b493e460f 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh.properties @@ -392,6 +392,7 @@ install.change_version=變更版本 install.change_version.confirm=你確定要 %s 從 %s 更新到 %s 嗎? install.failed=安裝失敗 install.failed.downloading=安裝失敗,部分檔案未能完成下載 +install.failed.downloading.access_denied=未能下載文件:%1$s。因為無法訪問文件 %2$s,HMCL 沒有對該文件的訪問權限,或者該文件被其他程序打開。你可以嘗試關閉相關程序,或者重啟電腦再試。 install.failed.downloading.detail=未能下載檔案: %s install.failed.downloading.timeout=下載逾時: %s install.failed.install_online=無法識別要安裝的軟體。如果你要安裝 Mod,你需要在模組管理頁面安裝模組。 diff --git a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties index 514ed535c..97d07540a 100644 --- a/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties +++ b/HMCL/src/main/resources/assets/lang/I18N_zh_CN.properties @@ -392,6 +392,7 @@ install.change_version=更换版本 install.change_version.confirm=你确定要将 %s 从 %s 更新到 %s 吗? install.failed=安装失败 install.failed.downloading=安装失败,部分文件未能完成下载 +install.failed.downloading.access_denied=未能下载文件:%1$s。因为无法访问文件 %2$s,HMCL 没有对该文件的访问权限,或者该文件被其他程序打开。你可以尝试关闭相关程序,或者重启电脑再试。 install.failed.downloading.detail=未能下载文件:%s install.failed.downloading.timeout=下载超时:%s install.failed.install_online=无法识别要安装的软件。如果你要安装 Mod,你需要在模组管理页面安装模组。