tools/kconfig2html.c: Update to handle absolute paths when sourcing Kconfig files.
This commit is contained in:
parent
486212a750
commit
5ddeffdef8
@ -2245,33 +2245,44 @@ static char *parse_kconfigfile(FILE *stream, const char *kconfigdir)
|
||||
{
|
||||
/* Get the relative path from the Kconfig file line */
|
||||
|
||||
char *relpath = get_token();
|
||||
char *source = get_token();
|
||||
|
||||
/* Remove optional quoting */
|
||||
|
||||
relpath = dequote(relpath);
|
||||
if (relpath)
|
||||
source = dequote(source);
|
||||
if (source)
|
||||
{
|
||||
char *subdir = dirname(relpath);
|
||||
char *subdir = dirname(source);
|
||||
char *dirpath;
|
||||
|
||||
/* Check if the directory path contains $APPSDIR */
|
||||
/* Check for an absolute path */
|
||||
|
||||
char *appsdir = strstr(subdir, "$APPSDIR");
|
||||
if (appsdir)
|
||||
if (source[0] == '/')
|
||||
{
|
||||
char *tmp = appsdir + strlen("$APPSDIR");
|
||||
|
||||
*appsdir = '\0';
|
||||
asprintf(&dirpath, "%s/%s%s%s", g_kconfigroot, subdir, g_appsdir, tmp);
|
||||
dirpath = strdup(subdir);
|
||||
}
|
||||
else
|
||||
{
|
||||
asprintf(&dirpath, "%s/%s", g_kconfigroot, subdir);
|
||||
/* Check if the directory path contains $APPSDIR */
|
||||
|
||||
char *appsdir = strstr(subdir, "$APPSDIR");
|
||||
if (appsdir)
|
||||
{
|
||||
char *tmp = appsdir + strlen("$APPSDIR");
|
||||
|
||||
*appsdir = '\0';
|
||||
asprintf(&dirpath, "%s/%s%s%s",
|
||||
g_kconfigroot, subdir, g_appsdir, tmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
asprintf(&dirpath, "%s/%s", g_kconfigroot, subdir);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
debug("parse_kconfigfile: Recursing for TOKEN_SOURCE\n");
|
||||
debug(" relpath: %s\n", relpath);
|
||||
debug(" source: %s\n", source);
|
||||
debug(" subdir: %s\n", subdir);
|
||||
debug(" dirpath: %s\n", dirpath);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user