Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -96,9 +96,9 @@ async def delete_item(websocket, key,project_name, path, connected):
|
|
96 |
# print(e)
|
97 |
websockets.broadcast(connected,str(e))
|
98 |
|
99 |
-
async def get_file_content(websocket, key,project_name, path,name,connected):
|
100 |
|
101 |
-
file_path = os.path.join(os.getcwd(), 'projects', key,project_name,
|
102 |
|
103 |
try:
|
104 |
with open(file_path, 'r', encoding='utf-8') as file:
|
@@ -107,6 +107,7 @@ async def get_file_content(websocket, key,project_name, path,name,connected):
|
|
107 |
"type": "content",
|
108 |
"content": content,
|
109 |
'fileName':name,
|
|
|
110 |
'filePath':path,
|
111 |
}
|
112 |
await websocket.send(json.dumps(event))
|
@@ -333,7 +334,7 @@ async def exe(websocket,connected,key):
|
|
333 |
await delete_item(websocket, key,event["project_name"], event["path"], connected)
|
334 |
elif event["command"]["type"]=="get_content":
|
335 |
|
336 |
-
await get_file_content(websocket, key,event["project_name"],
|
337 |
elif event["command"]["type"]=="rename":
|
338 |
|
339 |
await rename_item(websocket, key,event["project_name"], event["path"], event["name"], connected)
|
|
|
96 |
# print(e)
|
97 |
websockets.broadcast(connected,str(e))
|
98 |
|
99 |
+
async def get_file_content(websocket, key,project_name, path,rpath,name,connected):
|
100 |
|
101 |
+
file_path = os.path.join(os.getcwd(), 'projects', key,project_name, rpath)
|
102 |
|
103 |
try:
|
104 |
with open(file_path, 'r', encoding='utf-8') as file:
|
|
|
107 |
"type": "content",
|
108 |
"content": content,
|
109 |
'fileName':name,
|
110 |
+
'rfilePath':rpath,
|
111 |
'filePath':path,
|
112 |
}
|
113 |
await websocket.send(json.dumps(event))
|
|
|
334 |
await delete_item(websocket, key,event["project_name"], event["path"], connected)
|
335 |
elif event["command"]["type"]=="get_content":
|
336 |
|
337 |
+
await get_file_content(websocket, key,event["project_name"],event["filePath"], event["rfilePath"],event["fileName"] ,connected)
|
338 |
elif event["command"]["type"]=="rename":
|
339 |
|
340 |
await rename_item(websocket, key,event["project_name"], event["path"], event["name"], connected)
|