Fix project initialization name

This commit is contained in:
xSlendiX 2022-12-12 20:52:54 +02:00
parent d244528dfb
commit 4c84be1312

12
main.c
View File

@ -299,6 +299,7 @@ char *get_username(void) {
}
bool create_manifest_file(char const *project_path) {
int i;
char *name;
char cwd[4096];
if (strlen(project_path) == 1 && project_path[0] == '.') {
@ -312,6 +313,15 @@ bool create_manifest_file(char const *project_path) {
} else {
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();
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;
}
fprintf(fd, SAMPLE_MANIFEST, name, uname);
fprintf(fd, SAMPLE_MANIFEST, fname, uname);
fclose(fd);