refactor: 重构创建配置文件函数

This commit is contained in:
Olia Lisa
2026-05-31 23:12:53 +08:00
parent 1ef1799a51
commit 149d8a2cb0
3 changed files with 14 additions and 19 deletions
+4 -3
View File
@@ -103,7 +103,8 @@ check_config_file(){
# 创建配置文件
create_config(){
local SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/bin" # 脚本文件夹绝对路径
local CONFIG_FILE="$SCRIPT_DIR/../config/config.json"
local CONFIG_DIR="$SCRIPT_DIR/../config"
local CONFIG_FILE="$CONFIG_DIR/config.json"
# 如果配置文件已存在,提示用户是否重新生成
if [ -e "$CONFIG_FILE" ]; then
@@ -122,10 +123,10 @@ create_config(){
read -p "输入您的选择: " CHOICE
case $CHOICE in
1)
create_tuic_config
create_tuic_config $CONFIG_DIR
;;
2)
create_hysteria_config
create_hysteria_config $CONFIG_DIR
;;
*)
echo "无效的选择, 请重新选择."