Ramesh-vani commited on
Commit
c67376c
·
verified ·
1 Parent(s): 64e6a96

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -19,7 +19,7 @@ WATCH = {}
19
  async def delete_item(websocket, project_name, path, connected):
20
  try:
21
 
22
- item_path = path
23
 
24
  if os.path.exists(item_path):
25
  if os.path.isdir(item_path):
@@ -27,13 +27,13 @@ async def delete_item(websocket, project_name, path, connected):
27
  elif os.path.isfile(item_path):
28
  os.remove(item_path) # Remove the file
29
 
30
- return jsonify({'success': True})
31
  else:
32
  print('item not found')
33
- return jsonify({'success': False, 'message': 'Item not found'})
34
  except Exception as e:
35
  print(e)
36
- return jsonify({'success': False, 'message': str(e)})
37
 
38
  async def create_file(websocket, project_name, path, connected):
39
  file_path = os.path.join(os.getcwd(), 'projects', project_name, path)
@@ -215,7 +215,7 @@ async def exe(websocket,connected):
215
 
216
  elif event["command"]["type"]=="delete":
217
 
218
- await wirte_file(websocket, event["project_name"], event["path"], event["content"], connected) #Todo
219
  elif event["command"]["type"]=="rename":
220
 
221
  await wirte_file(websocket, event["project_name"], event["path"], event["content"], connected) #Todo
 
19
  async def delete_item(websocket, project_name, path, connected):
20
  try:
21
 
22
+ item_path = os.path.join(os.getcwd(), 'projects', project_name, path)
23
 
24
  if os.path.exists(item_path):
25
  if os.path.isdir(item_path):
 
27
  elif os.path.isfile(item_path):
28
  os.remove(item_path) # Remove the file
29
 
30
+ websockets.broadcast(connected,{'success': True})
31
  else:
32
  print('item not found')
33
+ websockets.broadcast(connected,{'success': False, 'message': 'Item not found'})
34
  except Exception as e:
35
  print(e)
36
+ websockets.broadcast(connected,{'success': False, 'message': str(e)})
37
 
38
  async def create_file(websocket, project_name, path, connected):
39
  file_path = os.path.join(os.getcwd(), 'projects', project_name, path)
 
215
 
216
  elif event["command"]["type"]=="delete":
217
 
218
+ await delete_item(websocket, event["project_name"], event["path"], connected)
219
  elif event["command"]["type"]=="rename":
220
 
221
  await wirte_file(websocket, event["project_name"], event["path"], event["content"], connected) #Todo