From 7536a096ba2b52eee963e8bf837b90aaaf5e6b30 Mon Sep 17 00:00:00 2001 From: falkTX Date: Wed, 13 Jan 2021 14:27:20 +0000 Subject: [PATCH] Fix ttl generation when cross-compiling, running with wine Signed-off-by: falkTX --- libs/lv2-ttl-generator/lv2_ttl_generator.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/libs/lv2-ttl-generator/lv2_ttl_generator.cpp b/libs/lv2-ttl-generator/lv2_ttl_generator.cpp index bd19f416..81f092b3 100644 --- a/libs/lv2-ttl-generator/lv2_ttl_generator.cpp +++ b/libs/lv2-ttl-generator/lv2_ttl_generator.cpp @@ -62,7 +62,20 @@ int main(int argc, char* argv[]) basename[strrchr(base2, '.')-base2-1] = '\0'; } else - strcpy(basename, argv[1]); + { +#ifdef TTL_GENERATOR_WINDOWS + // Fix when running through wine + if (char* base2 = strrchr(argv[1], '/')) + { + strcpy(basename, base2+1); + basename[strrchr(base2, '.')-base2-1] = '\0'; + } + else +#endif + { + strcpy(basename, argv[1]); + } + } printf("Generate ttl data for '%s', basename: '%s'\n", argv[1], basename);