From 45737adc8bf661f46e058f8297051cbd480f9240 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=81=8D=E5=85=AE=E6=83=9A=E5=85=AE?=
<101191390+HIllya51@users.noreply.github.com>
Date: Sat, 27 Jul 2024 19:01:49 +0800
Subject: [PATCH] per
---
.../LunaTranslator/LunaTranslator_main.py | 15 +++++++++++++++
docs/zh/cantstart.md | 10 ++++++++--
2 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/LunaTranslator/LunaTranslator/LunaTranslator_main.py b/LunaTranslator/LunaTranslator/LunaTranslator_main.py
index 59a4312a..896218b6 100644
--- a/LunaTranslator/LunaTranslator/LunaTranslator_main.py
+++ b/LunaTranslator/LunaTranslator/LunaTranslator_main.py
@@ -126,6 +126,20 @@ def checkintegrity():
os._exit(0)
+def checkpermission():
+ from myutils.config import _TR
+ from qtsymbols import QMessageBox
+
+ try:
+ os.makedirs("userconfig", exist_ok=True)
+ except PermissionError:
+ msg = QMessageBox()
+ msg.setText(_TR("权限不足,请以管理员权限运行!"))
+ msg.setWindowTitle(_TR("错误"))
+ msg.exec()
+ os._exit(0)
+
+
def switchdir():
dirname = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
os.chdir(dirname)
@@ -145,5 +159,6 @@ if __name__ == "__main__":
app.setQuitOnLastWindowClosed(False)
checklang()
checkintegrity()
+ checkpermission()
loadmainui()
app.exit(app.exec())
diff --git a/docs/zh/cantstart.md b/docs/zh/cantstart.md
index 140786e3..eab71c19 100644
--- a/docs/zh/cantstart.md
+++ b/docs/zh/cantstart.md
@@ -1,6 +1,6 @@
## 无法启动软件?
-**1. Error/ModuleNotFoundError**
+#### **1. Error/ModuleNotFoundError**
@@ -9,7 +9,13 @@
-**2. 找不到重要组件**
+#### **2. Error/PermissionError**
+
+如果软件被放到`Program Files`等特殊文件夹,可能会没有读写权限。请使用管理员权限运行。
+
+
+
+#### **3. 找不到重要组件**