File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -42,17 +42,20 @@ async def run_command(
4242class LocalFileOperator (FileOperator ):
4343 """File operations implementation for local filesystem."""
4444
45+ def __init__ (self , encoding : str = "utf-8" ):
46+ self .encoding = encoding
47+
4548 async def read_file (self , path : PathLike ) -> str :
4649 """Read content from a local file."""
4750 try :
48- return Path (path ).read_text ()
51+ return Path (path ).read_text (encoding = self . encoding )
4952 except Exception as e :
5053 raise ToolError (f"Failed to read { path } : { str (e )} " ) from None
5154
5255 async def write_file (self , path : PathLike , content : str ) -> None :
5356 """Write content to a local file."""
5457 try :
55- Path (path ).write_text (content )
58+ Path (path ).write_text (content , encoding = self . encoding )
5659 except Exception as e :
5760 raise ToolError (f"Failed to write to { path } : { str (e )} " ) from None
5861
You can’t perform that action at this time.
0 commit comments