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):
|
Added the following import (line 28):
|
||||||
import os
|
import os
|
||||||
|
|
||||||
Added command to set current directory to folder loaded program is loaded from (line 236,237):
|
Added command to set current directory to folder loaded program is loaded from (line 236-239):
|
||||||
if file.rfind('/') != -1:
|
if file.rfind('/') == 0:
|
||||||
|
os.chdir('/')
|
||||||
|
elif file.rfind('/') != -1:
|
||||||
os.chdir(file[:file.rfind('/')])
|
os.chdir(file[:file.rfind('/')])
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -233,7 +233,9 @@ class Program:
|
||||||
except OSError:
|
except OSError:
|
||||||
raise OSError("Could not read file")
|
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('/')])
|
os.chdir(file[:file.rfind('/')])
|
||||||
|
|
||||||
def add_stmt(self, tokenlist):
|
def add_stmt(self, tokenlist):
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue