Ramesh-vani commited on
Commit
9f944f6
·
verified ·
1 Parent(s): b05d9e4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py CHANGED
@@ -16,6 +16,19 @@ JOIN = {}
16
 
17
  WATCH = {}
18
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  async def wirte_file(websocket, project_name, path, content):
20
  try:
21
  file_path = os.path.join(os.getcwd(), 'projects', project_name, path)
@@ -171,6 +184,15 @@ async def exe(websocket,connected):
171
  await execute_command(websocket, event["project_name"], event["command"])
172
  elif "write" in event:
173
 
 
 
 
 
 
 
 
 
 
174
  await wirte_file(websocket, event["project_name"], event["path"], event["content"]) #Todo
175
 
176
  else:
 
16
 
17
  WATCH = {}
18
 
19
+ async def create_file(websocket, project_name, path):
20
+ file_path = os.path.join(os.getcwd(), 'projects', project_name, path)
21
+ # Create the file
22
+ with open(file_path, 'w'):
23
+ pass
24
+ await websocket.send(f"file created to {file_path}")
25
+
26
+ async def create_folder(websocket, project_name, path):
27
+ folder_path = os.path.join(os.getcwd(), 'projects', project_name, path)
28
+ # Create the folder
29
+ os.makedirs(folder_path)
30
+ await websocket.send(f"folder created to {folder_path}")
31
+
32
  async def wirte_file(websocket, project_name, path, content):
33
  try:
34
  file_path = os.path.join(os.getcwd(), 'projects', project_name, path)
 
184
  await execute_command(websocket, event["project_name"], event["command"])
185
  elif "write" in event:
186
 
187
+ await wirte_file(websocket, event["project_name"], event["path"], event["content"])
188
+ elif "create" in event:
189
+
190
+ await wirte_file(websocket, event["project_name"], event["path"], event["content"]) #Todo
191
+ elif "delete" in event:
192
+
193
+ await wirte_file(websocket, event["project_name"], event["path"], event["content"]) #Todo
194
+ elif "rename" in event:
195
+
196
  await wirte_file(websocket, event["project_name"], event["path"], event["content"]) #Todo
197
 
198
  else: