Reorganize drivers and utility modules into lib/ subdirectory and update server and upload scripts
This commit is contained in:
@@ -510,6 +510,18 @@ class MCPServer:
|
||||
elif name == "write_file":
|
||||
path = str(args.get("path"))
|
||||
content = str(args.get("content"))
|
||||
# Auto-create parent directories on the device if present in the path
|
||||
import os
|
||||
parts = path.split('/')
|
||||
if len(parts) > 1:
|
||||
dir_path = ""
|
||||
for part in parts[:-1]:
|
||||
if part:
|
||||
dir_path = dir_path + "/" + part if dir_path else part
|
||||
try:
|
||||
os.mkdir(dir_path)
|
||||
except OSError:
|
||||
pass # Directory likely already exists
|
||||
with open(path, 'w') as f:
|
||||
f.write(content)
|
||||
return f"Successfully wrote {len(content)} characters to '{path}'."
|
||||
|
||||
Reference in New Issue
Block a user