Fix project initialization name
This commit is contained in:
parent
d244528dfb
commit
4c84be1312
12
main.c
12
main.c
@ -299,6 +299,7 @@ char *get_username(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool create_manifest_file(char const *project_path) {
|
bool create_manifest_file(char const *project_path) {
|
||||||
|
int i;
|
||||||
char *name;
|
char *name;
|
||||||
char cwd[4096];
|
char cwd[4096];
|
||||||
if (strlen(project_path) == 1 && project_path[0] == '.') {
|
if (strlen(project_path) == 1 && project_path[0] == '.') {
|
||||||
@ -312,6 +313,15 @@ bool create_manifest_file(char const *project_path) {
|
|||||||
} else {
|
} else {
|
||||||
name = basename((char *)project_path);
|
name = basename((char *)project_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *fname;
|
||||||
|
for (i = strlen(name) - 1; i >= 0; i--) {
|
||||||
|
if (name[i] == '/') {
|
||||||
|
fname = name + i + 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char *uname = get_username();
|
char *uname = get_username();
|
||||||
|
|
||||||
FILE *fd = fopen(text_format("%s/" MANIFEST_FNAME, project_path), "w+");
|
FILE *fd = fopen(text_format("%s/" MANIFEST_FNAME, project_path), "w+");
|
||||||
@ -320,7 +330,7 @@ bool create_manifest_file(char const *project_path) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fd, SAMPLE_MANIFEST, name, uname);
|
fprintf(fd, SAMPLE_MANIFEST, fname, uname);
|
||||||
|
|
||||||
fclose(fd);
|
fclose(fd);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user