mirror of
https://github.com/corca-ai/EVAL
synced 2024-10-30 09:20:44 +00:00
feat: make directory
This commit is contained in:
parent
cae5ea60b7
commit
be87550ff2
@ -4,6 +4,8 @@ write protocol:
|
||||
<filepath>
|
||||
<content>
|
||||
"""
|
||||
import os
|
||||
|
||||
from .verify import verify
|
||||
|
||||
|
||||
@ -21,6 +23,9 @@ class WriteCommand:
|
||||
|
||||
@verify
|
||||
def execute(self) -> str:
|
||||
dir_path = os.path.dirname(self.filepath)
|
||||
if dir_path:
|
||||
os.makedirs(dir_path, exist_ok=True)
|
||||
with open(self.filepath, self.mode) as f:
|
||||
f.write(self.content)
|
||||
return self.content
|
||||
|
Loading…
Reference in New Issue
Block a user