mirror of
https://github.com/Mzdyl/LiteLoaderQQNT_Install.git
synced 2026-10-18 14:37:00 +08:00
代码清理
This commit is contained in:
+11
-14
@@ -27,17 +27,17 @@ else
|
||||
pluginsDir=${custompluginsDir:-"$HOME/.config/LiteLoader-Plugins"}
|
||||
echo "插件目录: $pluginsDir"
|
||||
|
||||
# 检测当前 shell 类型
|
||||
if [ -n "$ZSH_VERSION" ] || [ "$(ps -p $$ -o comm=)" = "zsh" ]; then
|
||||
# 当前 shell 为 Zsh
|
||||
config_file="$HOME/.zshrc"
|
||||
elif [ "${SHELL##*/}" = "bash" ]; then
|
||||
config_file="$HOME/.bashrc"
|
||||
else
|
||||
echo "非bash或者zsh,跳过修改环境变量"
|
||||
echo "请将用户目录下 .bashrc 文件内 LL 相关内容自行拷贝到相应配置文件中"
|
||||
config_file="$HOME/.bashrc"
|
||||
fi
|
||||
# 检测当前 shell 类型
|
||||
if [ -n "$ZSH_VERSION" ] || [ "$(ps -p $$ -o comm=)" = "zsh" ]; then
|
||||
# 当前 shell 为 Zsh
|
||||
config_file="$HOME/.zshrc"
|
||||
elif [ "${SHELL##*/}" = "bash" ]; then
|
||||
config_file="$HOME/.bashrc"
|
||||
else
|
||||
echo "非bash或者zsh,跳过修改环境变量"
|
||||
echo "请将用户目录下 .bashrc 文件内 LL 相关内容自行拷贝到相应配置文件中"
|
||||
config_file="$HOME/.bashrc"
|
||||
fi
|
||||
|
||||
# 检查是否已存在LITELOADERQQNT_PROFILE
|
||||
if grep -q "export LITELOADERQQNT_PROFILE=" "$config_file"; then
|
||||
@@ -45,18 +45,15 @@ else
|
||||
if [ "$modify_choice" = "y" ] || [ "$modify_choice" = "Y" ]; then
|
||||
# 如果用户同意修改,则替换原有的行
|
||||
sudo sed -i 's|export LITELOADERQQNT_PROFILE=.*|export LITELOADERQQNT_PROFILE="'$pluginsDir'"|' "$config_file"
|
||||
|
||||
echo "LITELOADERQQNT_PROFILE 已修改为: $pluginsDir"
|
||||
else
|
||||
echo "未修改 LITELOADERQQNT_PROFILE。"
|
||||
pluginsDir=$config_file
|
||||
fi
|
||||
else
|
||||
# 如果不存在,则添加新的行
|
||||
echo 'export LITELOADERQQNT_PROFILE="'$pluginsDir'"' >> "$config_file"
|
||||
echo "已添加 LITELOADERQQNT_PROFILE: $pluginsDir"
|
||||
fi
|
||||
|
||||
source $config_file
|
||||
else
|
||||
pluginsDir='/opt/LiteLoader/plugins'
|
||||
|
||||
+1
-2
@@ -93,6 +93,7 @@ def read_registry_key(hive, subkey, value_name):
|
||||
print(f"注册表读取失败: {e}")
|
||||
return None
|
||||
|
||||
|
||||
def compare_versions(version1, version2):
|
||||
v1_parts = [int(part) for part in version1.split('.')]
|
||||
v2_parts = [int(part) for part in version2.split('.')]
|
||||
@@ -110,7 +111,6 @@ def compare_versions(version1, version2):
|
||||
return False # 两个版本号相等
|
||||
|
||||
|
||||
|
||||
def check_for_updates():
|
||||
try:
|
||||
# 获取最新版本号
|
||||
@@ -255,7 +255,6 @@ def copy_old_files(file_path):
|
||||
if os.path.exists(old_plugins_path):
|
||||
shutil.copytree(old_plugins_path, os.path.join(new_liteloader_path, "plugins"), dirs_exist_ok=True)
|
||||
print("已将 LiteLoader_bak 中旧插件 Plugins 复制到新的 LiteLoader 目录")
|
||||
old_config_path = os.path.join(file_path, 'resources', 'app', 'LiteLoaderQQNT_bak')
|
||||
# 复制 LiteLoader_bak 中的数据文件到新的 LiteLoader 目录
|
||||
old_data_path = os.path.join(file_path, 'resources', 'app', 'LiteLoaderQQNT_bak', 'data')
|
||||
if os.path.exists(old_data_path):
|
||||
|
||||
Reference in New Issue
Block a user