Extract correctly the data directory when the wizard is executed
authorrasky <rasky@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 25 Mar 2010 16:31:12 +0000 (16:31 +0000)
committerrasky <rasky@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 25 Mar 2010 16:31:12 +0000 (16:31 +0000)
through a symlink

git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3273 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/bertos.py

index 24d61e03ff14f1cf49201535889d6adffdfdbd99..53fa11383f47ad2131c543c31939f7c37c7b0395 100755 (executable)
@@ -79,7 +79,7 @@ def newProject():
             relevant_file = relevant_files[ide]
             QProcess.startDetached(command_line, [relevant_file,])
     sys.exit()
-    
+
 def editProject(project_file):
     info_dict = {}
     while(True):
@@ -120,7 +120,11 @@ def showStartPage():
 
 def main():
     rundir = os.getcwd()
-    os.chdir(os.path.dirname(os.path.abspath(sys.argv[0])))
+    datadir = sys.argv[0]
+    if os.path.islink(datadir):
+        datadir = os.readlink(datadir)
+    datadir = os.path.dirname(os.path.abspath(datadir))
+    os.chdir(datadir)
     app = QApplication(sys.argv)
     app.settings = QSettings("Develer", "Bertos Configurator")
     app.project = BProject.BProject()
@@ -132,7 +136,7 @@ def main():
         editProject(os.path.join(rundir, sys.argv[2]))
     else:
         newProject()
+
 
 if __name__ == '__main__':
     main()