Fixed "make dist" when either the path or the filename contains spaces
This commit is contained in:
parent
afdfa13eff
commit
17ece7ff43
@ -1654,6 +1654,7 @@ static int _dist_subdir(Config * config, FILE * fp, Config * subdir)
|
|||||||
String const * dist;
|
String const * dist;
|
||||||
size_t i;
|
size_t i;
|
||||||
char c;
|
char c;
|
||||||
|
String const * quote;
|
||||||
|
|
||||||
path = config_get(config, NULL, "directory");
|
path = config_get(config, NULL, "directory");
|
||||||
len = string_length(path);
|
len = string_length(path);
|
||||||
@ -1687,8 +1688,9 @@ static int _dist_subdir(Config * config, FILE * fp, Config * subdir)
|
|||||||
_dist_subdir_dist(fp, path, includes);
|
_dist_subdir_dist(fp, path, includes);
|
||||||
if((dist = config_get(subdir, NULL, "dist")) != NULL)
|
if((dist = config_get(subdir, NULL, "dist")) != NULL)
|
||||||
_dist_subdir_dist(fp, path, dist);
|
_dist_subdir_dist(fp, path, dist);
|
||||||
fprintf(fp, "%s%s%s%s%s", "\t\t$(PACKAGE)-$(VERSION)/", path,
|
quote = (strchr(path, ' ') != NULL) ? "\"" : "";
|
||||||
path[0] == '\0' ? "" : "/", PROJECT_CONF,
|
fprintf(fp, "%s%s%s%s%s%s%s%s", "\t\t", quote, "$(PACKAGE)-$(VERSION)/",
|
||||||
|
path, path[0] == '\0' ? "" : "/", PROJECT_CONF, quote,
|
||||||
path[0] == '\0' ? "\n" : " \\\n");
|
path[0] == '\0' ? "\n" : " \\\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1700,6 +1702,7 @@ static int _dist_subdir_dist(FILE * fp, String const * path,
|
|||||||
String * p;
|
String * p;
|
||||||
size_t i;
|
size_t i;
|
||||||
char c;
|
char c;
|
||||||
|
String const * quote;
|
||||||
|
|
||||||
if((d = string_new(dist)) == NULL)
|
if((d = string_new(dist)) == NULL)
|
||||||
return 1;
|
return 1;
|
||||||
@ -1710,9 +1713,13 @@ static int _dist_subdir_dist(FILE * fp, String const * path,
|
|||||||
continue;
|
continue;
|
||||||
c = d[i];
|
c = d[i];
|
||||||
d[i] = '\0';
|
d[i] = '\0';
|
||||||
fprintf(fp, "%s%s%s%s%s", "\t\t$(PACKAGE)-$(VERSION)/",
|
quote = (strchr(path, ' ') != NULL || strchr(d, ' ') != NULL)
|
||||||
path[0] == '\0' ? "" : path,
|
? "\"" : "";
|
||||||
path[0] == '\0' ? "" : "/", d, " \\\n");
|
fprintf(fp, "%s%s%s%s%s%s%s%s", "\t\t", quote,
|
||||||
|
"$(PACKAGE)-$(VERSION)/",
|
||||||
|
(path[0] == '\0') ? "" : path,
|
||||||
|
(path[0] == '\0') ? "" : "/",
|
||||||
|
d, quote, " \\\n");
|
||||||
if(c == '\0')
|
if(c == '\0')
|
||||||
break;
|
break;
|
||||||
d[i] = c;
|
d[i] = c;
|
||||||
|
Loading…
Reference in New Issue
Block a user