[Libreoffice-commits] core.git: bin/gbuild-to-ide

Michael Weghorn (via logerrit) logerrit at kemper.freedesktop.org
Fri Jul 5 10:55:44 UTC 2019


 bin/gbuild-to-ide |    9 +++++++++
 1 file changed, 9 insertions(+)

New commits:
commit 22c6ffc274a4dd29fdd6c0d02415139502bddae6
Author:     Michael Weghorn <m.weghorn at posteo.de>
AuthorDate: Fri Jul 5 08:46:10 2019 +0100
Commit:     Michael Weghorn <m.weghorn at posteo.de>
CommitDate: Fri Jul 5 12:54:48 2019 +0200

    qtcreator: Make paths work with cygwin
    
    Absolute paths in files created by GbuildToJson
    in Cygwin environment are Windows paths
    (like "C:/....'), while relative paths in the Python
    program executed in Cygwin are treated as Unix paths
    ('/cygdrive/c/....') which caused wrong relative paths to
    be generated by the call to 'os.relpath'. It would walk up to
    the root of the Windows path and then walk down the tree in the
    Unix file system path again.
    
    This converts the paths to absolute Windows paths first to avoid
    this issue.
    
    Change-Id: I2e3e6926e312d64aa18067933a5903ac7ad5d31a
    Reviewed-on: https://gerrit.libreoffice.org/75114
    Tested-by: Jenkins
    Reviewed-by: Michael Weghorn <m.weghorn at posteo.de>

diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide
index f1121efddabb..bcb3ec41ba4a 100755
--- a/bin/gbuild-to-ide
+++ b/bin/gbuild-to-ide
@@ -9,6 +9,7 @@
 #
 
 import argparse
+import ntpath
 import os
 import os.path
 import shutil
@@ -1648,6 +1649,14 @@ class QtCreatorIntegrationGenerator(IdeIntegrationGenerator):
             lib_folder = os.path.relpath(lib.location, self.base_folder)
 
             def lopath(path):
+                if platform =="cygwin":
+                    # absolute paths from GbuildToJson are Windows paths,
+                    # so convert everything to such ones
+                    abs_path = path
+                    if not ntpath.isabs(abs_path):
+                        abs_path = ntpath.join(self.gbuildparser.srcdir, path)
+                    return ntpath.relpath(abs_path, lib.location).replace('\\', '/')
+
                 return os.path.relpath(path, lib.location)
 
             defines_list = []


More information about the Libreoffice-commits mailing list