MCPcopy Create free account
hub / github.com/agentforce314/clawcodex / _ensure_file

Function _ensure_file

src/command_system/memory_command.py:131–141  ·  view source on GitHub ↗

TS parity: mkdir the claude home when the path is under it, then exclusive-create an empty file (existing content preserved).

(path: str)

Source from the content-addressed store, hash-verified

129
130
131def _ensure_file(path: str) -> None:
132 """TS parity: mkdir the claude home when the path is under it, then
133 exclusive-create an empty file (existing content preserved)."""
134 claude_home = str(Path.home() / ".claude")
135 if path.startswith(claude_home):
136 Path(claude_home).mkdir(parents=True, exist_ok=True)
137 try:
138 with open(path, "x", encoding="utf-8"):
139 pass
140 except FileExistsError:
141 pass
142
143
144_EDITOR_HINT = (

Callers 1

runMethod · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected