Ramesh-vani commited on
Commit
e43a80a
·
verified ·
1 Parent(s): 2a83ff3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -71,8 +71,8 @@ async def delete_item(websocket, project_name, path, connected):
71
  # print(e)
72
  websockets.broadcast(connected,str(e))
73
 
74
- async def create_file(websocket, project_name, path, connected):
75
- file_path = os.path.join(os.getcwd(), 'projects', project_name, path)
76
  # Create the file
77
  with open(file_path, 'w'):
78
  pass
@@ -83,8 +83,8 @@ async def create_file(websocket, project_name, path, connected):
83
  websockets.broadcast(connected,json.dumps(event))
84
 
85
 
86
- async def create_folder(websocket, project_name, path, connected):
87
- folder_path = os.path.join(os.getcwd(), 'projects', project_name, path)
88
  # Create the folder
89
  os.makedirs(folder_path)
90
  event = {
@@ -268,9 +268,9 @@ async def exe(websocket,connected):
268
  await wirte_file(websocket, event["project_name"], event["path"], event["content"], connected)
269
  elif event["command"]["type"]=="create":
270
  if event["item"]=="folder":
271
- await create_folder(websocket, event["project_name"], event["path"], connected)
272
  else:
273
- await create_file(websocket, event["project_name"], event["path"], connected)
274
 
275
 
276
  elif event["command"]["type"]=="delete":
 
71
  # print(e)
72
  websockets.broadcast(connected,str(e))
73
 
74
+ async def create_file(websocket, project_name, path,name, connected):
75
+ file_path = os.path.join(os.getcwd(), 'projects', project_name, path,name)
76
  # Create the file
77
  with open(file_path, 'w'):
78
  pass
 
83
  websockets.broadcast(connected,json.dumps(event))
84
 
85
 
86
+ async def create_folder(websocket, project_name, path,name, connected):
87
+ folder_path = os.path.join(os.getcwd(), 'projects', project_name, path,name)
88
  # Create the folder
89
  os.makedirs(folder_path)
90
  event = {
 
268
  await wirte_file(websocket, event["project_name"], event["path"], event["content"], connected)
269
  elif event["command"]["type"]=="create":
270
  if event["item"]=="folder":
271
+ await create_folder(websocket, event["project_name"], event["path"],event["name"], connected)
272
  else:
273
+ await create_file(websocket, event["project_name"], event["path"],event["name"], connected)
274
 
275
 
276
  elif event["command"]["type"]=="delete":