Browse Source

Fix Directory when no examples-dir present

bernhardbuhl 4 years ago
parent
commit
ad30e3f0a5
1 changed files with 10 additions and 5 deletions
  1. 10 5
      baangt/ui/ui.py

+ 10 - 5
baangt/ui/ui.py

@@ -34,6 +34,10 @@ class UI:
         self.mainWindowPosition = (None, None)
 
         self.readConfig()
+
+        if not self.directory:
+            self.directory = os.getcwd()
+
         self.getConfigFilesInDirectory()
 
         self.startWindow()
@@ -355,11 +359,12 @@ class UI:
             self.readContentsOfGlobals()
         except Exception as e:
             # if baangt.ini is not there. Default the directory to /examples.
-            self.directory = Path(os.getcwd()).joinpath("examples")
-            self.testRunFile = 'simpleAutomationpractice.xlsx'
-            self.configFile = 'globals.json'
-            self.mainWindowPosition = (20,30)
-            self.readContentsOfGlobals()
+            if Path(os.getcwd()).joinpath("examples").exists():
+                self.directory = Path(os.getcwd()).joinpath("examples")
+                self.testRunFile = 'simpleAutomationpractice.xlsx'
+                self.configFile = 'globals.json'
+                self.mainWindowPosition = (20,30)
+                self.readContentsOfGlobals()
 
     @staticmethod
     def __convert_configPosition2Tuple(inString):