Fix for loading basic programs from root directory
This commit is contained in:
parent
478b550a17
commit
bc2ce6a2d3
2 changed files with 7 additions and 3 deletions
|
|
@ -14,7 +14,9 @@ New: print_exception(e,e,e.__traceback__ if hasattr(e,'__traceback__') else None
|
|||
Added the following import (line 28):
|
||||
import os
|
||||
|
||||
Added command to set current directory to folder loaded program is loaded from (line 236,237):
|
||||
if file.rfind('/') != -1:
|
||||
Added command to set current directory to folder loaded program is loaded from (line 236-239):
|
||||
if file.rfind('/') == 0:
|
||||
os.chdir('/')
|
||||
elif file.rfind('/') != -1:
|
||||
os.chdir(file[:file.rfind('/')])
|
||||
|
||||
|
|
|
|||
|
|
@ -233,7 +233,9 @@ class Program:
|
|||
except OSError:
|
||||
raise OSError("Could not read file")
|
||||
|
||||
if file.rfind('/') != -1:
|
||||
if file.rfind('/') == 0:
|
||||
os.chdir("/")
|
||||
elif file.rfind('/') != -1:
|
||||
os.chdir(file[:file.rfind('/')])
|
||||
|
||||
def add_stmt(self, tokenlist):
|
||||
|
|
|
|||
Loading…
Reference in a new issue