fix: 修正目录路径拼接问题
This commit is contained in:
7
app.py
7
app.py
@@ -17,7 +17,8 @@ import urllib.error
|
||||
app = Flask(__name__)
|
||||
|
||||
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
|
||||
WORKSPACE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||
WORKSPACE_DIR = os.path.dirname(BASE_DIR) # works目录
|
||||
ROOT_DIR = os.path.dirname(WORKSPACE_DIR) # workspace-coder目录
|
||||
PROJECTS_FILE = os.path.join(BASE_DIR, 'projects.json')
|
||||
|
||||
# 进程状态缓存
|
||||
@@ -678,7 +679,7 @@ def api_start(project_id):
|
||||
if directory.startswith('/'):
|
||||
cwd = directory
|
||||
else:
|
||||
cwd = os.path.join(WORKSPACE_DIR, directory)
|
||||
cwd = os.path.join(ROOT_DIR, directory)
|
||||
|
||||
if not os.path.exists(cwd):
|
||||
return jsonify({'error': f'目录不存在: {cwd}'}), 400
|
||||
@@ -727,7 +728,7 @@ def api_run(project_id):
|
||||
if directory.startswith('/'):
|
||||
cwd = directory
|
||||
else:
|
||||
cwd = os.path.join(WORKSPACE_DIR, directory)
|
||||
cwd = os.path.join(ROOT_DIR, directory)
|
||||
|
||||
cmd = project.get('run_cmd', '')
|
||||
if not cmd:
|
||||
|
||||
Reference in New Issue
Block a user