|
|
@@ -17,10 +17,9 @@ def resolve_path(base_path, file_path):
|
|
|
@dataclass
|
|
|
class FileReadAction(ExecutableAction):
|
|
|
path: str
|
|
|
- base_path: str = ""
|
|
|
|
|
|
- def run(self, *args, **kwargs) -> FileReadObservation:
|
|
|
- path = resolve_path(self.base_path, self.path)
|
|
|
+ def run(self, controller) -> FileReadObservation:
|
|
|
+ path = resolve_path(controller.workdir, self.path)
|
|
|
with open(path, 'r', encoding='utf-8') as file:
|
|
|
return FileReadObservation(
|
|
|
path=path,
|
|
|
@@ -35,10 +34,9 @@ class FileReadAction(ExecutableAction):
|
|
|
class FileWriteAction(ExecutableAction):
|
|
|
path: str
|
|
|
contents: str
|
|
|
- base_path: str = ""
|
|
|
|
|
|
- def run(self, *args, **kwargs) -> FileWriteObservation:
|
|
|
- path = resolve_path(self.base_path, self.path)
|
|
|
+ def run(self, controller) -> FileWriteObservation:
|
|
|
+ path = resolve_path(controller.workdir, self.path)
|
|
|
with open(path, 'w', encoding='utf-8') as file:
|
|
|
file.write(self.contents)
|
|
|
return FileWriteObservation(content="", path=self.path)
|