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 */
|
/* Get the relative path from the Kconfig file line */
|
||||||
|
|
||||||
char *relpath = get_token();
|
char *source = get_token();
|
||||||
|
|
||||||
/* Remove optional quoting */
|
/* Remove optional quoting */
|
||||||
|
|
||||||
relpath = dequote(relpath);
|
source = dequote(source);
|
||||||
if (relpath)
|
if (source)
|
||||||
{
|
{
|
||||||
char *subdir = dirname(relpath);
|
char *subdir = dirname(source);
|
||||||
char *dirpath;
|
char *dirpath;
|
||||||
|
|
||||||
/* Check if the directory path contains $APPSDIR */
|
/* Check for an absolute path */
|
||||||
|
|
||||||
char *appsdir = strstr(subdir, "$APPSDIR");
|
if (source[0] == '/')
|
||||||
if (appsdir)
|
|
||||||
{
|
{
|
||||||
char *tmp = appsdir + strlen("$APPSDIR");
|
dirpath = strdup(subdir);
|
||||||
|
|
||||||
*appsdir = '\0';
|
|
||||||
asprintf(&dirpath, "%s/%s%s%s", g_kconfigroot, subdir, g_appsdir, tmp);
|
|
||||||
}
|
}
|
||||||
else
|
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("parse_kconfigfile: Recursing for TOKEN_SOURCE\n");
|
||||||
debug(" relpath: %s\n", relpath);
|
debug(" source: %s\n", source);
|
||||||
debug(" subdir: %s\n", subdir);
|
debug(" subdir: %s\n", subdir);
|
||||||
debug(" dirpath: %s\n", dirpath);
|
debug(" dirpath: %s\n", dirpath);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user