summaryrefslogtreecommitdiff
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-11-04 08:07:24 +0100
commit13e8a6f5b247c17413a812eb07b482c04f9f4945 (patch)
tree18096ef9f68c85e92c3ae70336e2e01a54e5a060
parent5f3b7cbcfda41c748cfbc52f4b76b3364cdc048d (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> (cherry picked from commit 22c6ffc274a4dd29fdd6c0d02415139502bddae6)
-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 e76486c359b0..6e1717b37c80 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
@@ -1467,6 +1468,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 = []