From 1c7b2d81f98607aa57c6a4ca3bf9765be845a5c3 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Tue, 29 Mar 2011 19:30:54 +0000 Subject: LV2_PATH variable expansion on Windows. --- core.lv2/lv2config.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core.lv2/lv2config.c b/core.lv2/lv2config.c index 327d655..0fa6434 100644 --- a/core.lv2/lv2config.c +++ b/core.lv2/lv2config.c @@ -174,14 +174,13 @@ discover_manifest(World* world, const char* uri) world->state = NULL; } -/** Expand variables (e.g. ~) in path. */ +/** Expand variables (e.g. POSIX ~ or $FOO, Windows %FOO%) in @a path. */ static char* expand(const char* path) { #ifdef HAVE_WORDEXP char* ret = NULL; wordexp_t p; - wordexp(path, &p, 0); if (p.we_wordc == 0) { /* Literal directory path (e.g. no variables or ~) */ @@ -193,8 +192,11 @@ expand(const char* path) /* Multiple expansions in a single directory path? */ fprintf(stderr, "lv2config: malformed path `%s' ignored\n", path); } - wordfree(&p); +#elif defined(__WIN32__) + static const size_t len = 32767; + char* ret = malloc(len); + ExpandEnvironmentStrings(path, ret, len); #else char* ret = strdup(path); #endif -- cgit v1.2.1