diff --git a/builtin_apps/PyBasic/PyBasic changes.txt b/builtin_apps/PyBasic/PyBasic changes.txt index 6cb7e44..0e8a408 100644 --- a/builtin_apps/PyBasic/PyBasic changes.txt +++ b/builtin_apps/PyBasic/PyBasic changes.txt @@ -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('/')]) diff --git a/builtin_apps/PyBasic/program.py b/builtin_apps/PyBasic/program.py index 9550641..6d69aea 100644 --- a/builtin_apps/PyBasic/program.py +++ b/builtin_apps/PyBasic/program.py @@ -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):