projmr/Application/creating.c
2026-05-13 17:35:26 +04:00

68 lines
1.9 KiB
C

/*
* creating.c
*
* Copyright 2025
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
* MA 02110-1301, USA.
*
*
*/
#if !defined(__CREATING_C__)
#define __CREATING_C__
#include "../Library/creating.h"
static FILE* projmr_parse_line_and_open(char* buf) {
if (buf[0] == '/') {
buf ++;
}
}
int projmr_run_creating(char* name) {
projmr_info_log("Creating project...");
char buf[PROJMR_FILE_BUFFER_SIZE] = "\0";
FILE* fp = projmr_open_project_file(PROJMR_CONFIG_FILE_NAME, "r");
if (fp) {
while (fgets(buf, sizeof(buf), fp)) {
size_t len = strlen(buf);
if (len > 0 && buf[len - 1] != '\n') {
projmr_warning_log(
"The line was not read "
"completely (perhaps th"
"e last line in the fil"
"e does not end with \""
"\n\")" VOID_LINE_DETECT
);
}
FILE* ld = projmr_parse_line_and_open(buf);
if (ld) {
fclose(ld);
} else {
projmr_error_log("Cannot load file from config!");
}
}
return EXIT_SUCCESS;
} else {
projmr_error_log("Cannot load config!");
}
return EXIT_FAILURE;
}
#endif /* __CREATING_C__ */