diff options
Diffstat (limited to 'core.lv2/lv2config.c')
-rw-r--r-- | core.lv2/lv2config.c | 8 |
1 files 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 |