aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-03-29 19:30:54 +0000
committerDavid Robillard <d@drobilla.net>2011-03-29 19:30:54 +0000
commit1c7b2d81f98607aa57c6a4ca3bf9765be845a5c3 (patch)
treef91e18ad5ee310df01dc225124032f68f75dd531
parent15ed581cae9fa3d79827dea7e0d43927d6125c7e (diff)
downloadlv2-1c7b2d81f98607aa57c6a4ca3bf9765be845a5c3.tar.xz
LV2_PATH variable expansion on Windows.
-rw-r--r--core.lv2/lv2config.c8
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