Added INI dir check

Signed-off-by: luca0N! <63941044+luca0N@users.noreply.github.com>
This commit is contained in:
luca0N! 2020-05-04 08:30:18 -03:00
parent 1972eed113
commit 97dafa0ac2
No known key found for this signature in database
GPG Key ID: 9F1B99B522287CAB
2 changed files with 14 additions and 2 deletions

15
main.c
View File

@ -23,6 +23,7 @@
#include <windows.h>
#include <stdio.h>
#include <string.h>
int printLicense(int full){
if (full == 0) {
@ -46,10 +47,20 @@ int printLicense(int full){
void getAdditionalDirs(){
printf("%sRecolhendo pastas adicionais...\n", ANSI_COLOR_CYAN);
//FILE* adf = fopen("./adf.txt", "r");
int dirs;
dirs = GetPrivateProfileInt("Pastas", "Pastas", 3, ".\\cfg\\pastas.ini");
printf("%s %d\n", STR_DIR_COUNT, dirs);
fflush(stdout);
for(unsigned short x = 0; x < dirs; x++){
char dirKey[7] = "Pasta"; // PastaX...
//strcpy(dirKey, "Pasta");
char* intPtr = (x + 1) + '0';
strcat(dirKey, &intPtr);
_TCHAR currentPath[128];
GetPrivateProfileString("Pastas", dirKey, "null", currentPath,
sizeof(currentPath) / sizeof(currentPath[0]), ".\\cfg\\pastas.ini");
printf("%s [%s] %s\n", STR_FOUND_DIR, dirKey, currentPath);
}
}
void cleanLoadedDirs(){
@ -79,6 +90,6 @@ int main(void){
return 0;
getAdditionalDirs();
cleanLoadedDirs();
printf("%s\n", ANSI_COLOR_RESET);
printf("%s", ANSI_COLOR_RESET);
return 0;
}

1
str.h
View File

@ -28,6 +28,7 @@
#define STR_REMOVED_FILE "[Arquivo removido]"
#define STR_REMOVED_DIR "[Pasta removida]"
#define STR_DIR_COUNT "[Contagem de pastas]"
#define STR_FOUND_DIR "[Pasta encontrada]"
#define STR_ERROR_LIC "Falha ao ler arquivo de licença. Visite <https://www.gnu.org/licenses/> para mais informações."