summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2019-07-05 08:46:10 +0100
committerMichael Weghorn <m.weghorn@posteo.de>2019-07-05 12:54:48 +0200
commit22c6ffc274a4dd29fdd6c0d02415139502bddae6 (patch)
tree8f481d307d16b52f6a2f94b1e6d6d3d6f80f6f06 /bin
parent13f73dcc15370df94001cc40883069f76ba317de (diff)
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@posteo.de>
Diffstat (limited to 'bin')
-rwxr-xr-xbin/gbuild-to-ide9
1 files changed, 9 insertions, 0 deletions
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 = []