@@ -154,6 +154,7 @@ def statSync_inner(filename: str) -> Union[Dict[str, int], bool]:
154154 Union[Dict[str, int], False]: The mode of the file or False if the file doesn't exist.
155155 """
156156 from os import stat
157+ filename = os .path .normpath (filename )
157158 if (os .path .exists (filename )):
158159 sb = stat (filename )
159160 return { 'mode' : sb .st_mode }
@@ -166,12 +167,17 @@ def readFileSync(filename, charset) -> str:
166167 Returns:
167168 str: The contents of the file
168169 """
170+ filename = os .path .normpath (filename )
169171 with open (filename , "r" , encoding = charset ) as fileHnd :
170172 return fileHnd .read ()
171173
174+ def existsSync (filename : str ) -> bool :
175+ filename = os .path .normpath (filename )
176+ return os .path .exists (filename )
177+
172178bootstrap .modules .fs .statSync_inner = statSync_inner
173179bootstrap .modules .fs .readFileSync = readFileSync
174- bootstrap .modules .fs .existsSync = os . path . exists
180+ bootstrap .modules .fs .existsSync = existsSync
175181
176182# Read ctx-module module from disk and invoke so that this file is the "main module" and ctx-module has
177183# require and exports symbols injected from the bootstrap object above. Current PythonMonkey bugs
@@ -201,6 +207,7 @@ def load(filename: str) -> Dict:
201207 : The loaded python module
202208 """
203209
210+ filename = os .path .normpath (filename )
204211 name = os .path .basename (filename )
205212 if name not in sys .modules :
206213 sourceFileLoader = machinery .SourceFileLoader (name , filename )
0 commit comments