/* * 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" #define PROJMR_INITIAL_FILE_NAME ".powered_by_projmr" int projmr_run_creating(char* name) { FILE* test = NULL; if ((test = fopen(PROJMR_INITIAL_FILE_NAME, "r"))) { fclose(test); projmr_error_log("The project has already been initialized!"); return EXIT_FAILURE; } projmr_info_log("Creating project..."); char buf[PROJMR_FILE_BUFFER_SIZE] = "\0"; FILE* fp = projmr_open_project_file( PROJMR_TEMPLATES_PATH PROJMR_CATALOG_NEW PROJMR_CONFIG_FILE_NAME, "r" ); if (fp) { while (fgets(buf, sizeof(buf), fp)) { if (strlen(buf) == 0) { continue; } if (buf[strlen(buf) - 1] == '\n') { buf[strlen(buf) - 1] = '\0'; } if (strlen(buf) == 0) { continue; } if (buf[strlen(buf) - 1] == '\r') { buf[strlen(buf) - 1] = '\0'; } if (strlen(buf) == 0) { continue; } cue_parse_result_t* res = cue_parse_file(buf, name); FILE* templ = res->input; FILE* out = res->output; if (!templ) { projmr_error_log("Cannot load template file!"); } else { } } projmr_success_log("Project initialized success!"); return EXIT_SUCCESS; } else { projmr_error_log("Cannot load config!"); } return EXIT_FAILURE; } #endif /* __CREATING_C__ */