Made strings consistent
This commit is contained in:
parent
6406a6c9b3
commit
5674fb7e3c
22
main.c
22
main.c
|
@ -75,7 +75,7 @@ void cleanDir(const char* path, unsigned* objectCount, unsigned long* totalDelet
|
||||||
strcpy(wildPath, validPath);
|
strcpy(wildPath, validPath);
|
||||||
strcat(wildPath, "*");
|
strcat(wildPath, "*");
|
||||||
|
|
||||||
printf("%s %s\n", STR_CLEANING_DIR, wildPath);
|
printf(STR_CLEANING_DIR, wildPath);
|
||||||
// Fetch files in dir
|
// Fetch files in dir
|
||||||
WIN32_FIND_DATA data;
|
WIN32_FIND_DATA data;
|
||||||
HANDLE hFind = FindFirstFile(wildPath, &data);
|
HANDLE hFind = FindFirstFile(wildPath, &data);
|
||||||
|
@ -86,7 +86,7 @@ void cleanDir(const char* path, unsigned* objectCount, unsigned long* totalDelet
|
||||||
iteration++;
|
iteration++;
|
||||||
if (iteration <= 2)
|
if (iteration <= 2)
|
||||||
continue;
|
continue;
|
||||||
printf("%s %s\n", STR_FOUND_ITEM, data.cFileName);
|
printf(STR_FOUND_ITEM, data.cFileName);
|
||||||
// Attempt to delete item...
|
// Attempt to delete item...
|
||||||
|
|
||||||
int pathSize = strlen(wildPath) + strlen(data.cFileName);
|
int pathSize = strlen(wildPath) + strlen(data.cFileName);
|
||||||
|
@ -130,7 +130,7 @@ void cleanDir(const char* path, unsigned* objectCount, unsigned long* totalDelet
|
||||||
setConsoleColor(RESET_CONSOLE_COLOR);
|
setConsoleColor(RESET_CONSOLE_COLOR);
|
||||||
} else {
|
} else {
|
||||||
setConsoleColor(FOREGROUND_INTENSITY | FOREGROUND_BLUE);
|
setConsoleColor(FOREGROUND_INTENSITY | FOREGROUND_BLUE);
|
||||||
printf(" %s\n", STR_DELETED_FILE);
|
printf(STR_DELETED_FILE);
|
||||||
// Update the deleted object count if the process was successful.
|
// Update the deleted object count if the process was successful.
|
||||||
(*objectCount)++;
|
(*objectCount)++;
|
||||||
(*totalDeletedBytes) += length;
|
(*totalDeletedBytes) += length;
|
||||||
|
@ -149,7 +149,7 @@ void getAdditionalDirs(bool safeMode){
|
||||||
printf("\n%s\n", STR_FETCHING_ADD_DIRS);
|
printf("\n%s\n", STR_FETCHING_ADD_DIRS);
|
||||||
int dirs;
|
int dirs;
|
||||||
dirs = GetPrivateProfileInt("Pastas", "Pastas", 3, PATH_CFG);
|
dirs = GetPrivateProfileInt("Pastas", "Pastas", 3, PATH_CFG);
|
||||||
printf("%s %d\n", STR_DIR_COUNT, dirs);
|
printf(STR_DIR_COUNT, dirs);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
for(unsigned short x = 0; x < dirs; x++){
|
for(unsigned short x = 0; x < dirs; x++){
|
||||||
char dirKey[7] = "Pasta";
|
char dirKey[7] = "Pasta";
|
||||||
|
@ -216,25 +216,25 @@ void getAdditionalDirs(bool safeMode){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("%s [%s] %s\n", STR_FOUND_DIR, dirKey, currentPath);
|
printf(STR_FOUND_DIR, dirKey, currentPath);
|
||||||
|
|
||||||
if (!safeMode)
|
if (!safeMode)
|
||||||
cleanDir(currentPath, &objectCount, &totalDeletedBytes);
|
cleanDir(currentPath, &objectCount, &totalDeletedBytes);
|
||||||
}
|
}
|
||||||
setConsoleColor(FOREGROUND_INTENSITY | FOREGROUND_GREEN);
|
setConsoleColor(FOREGROUND_INTENSITY | FOREGROUND_GREEN);
|
||||||
printf(FMT_STR_OBJECT_COUNT, objectCount);
|
printf(STR_OBJECT_COUNT, objectCount);
|
||||||
// Determine whether we should output the size as bytes, KiB, MiB or GiB.
|
// Determine whether we should output the size as bytes, KiB, MiB or GiB.
|
||||||
if (totalDeletedBytes < 1024){
|
if (totalDeletedBytes < 1024){
|
||||||
printf(FMT_STR_TOTAL_DELETED_BYTES, totalDeletedBytes);
|
printf(STR_TOTAL_DELETED_BYTES, totalDeletedBytes);
|
||||||
} else if (totalDeletedBytes < (unsigned long) pow(1024, 2)){
|
} else if (totalDeletedBytes < (unsigned long) pow(1024, 2)){
|
||||||
float kib = (unsigned long) totalDeletedBytes / pow(1024, 1);
|
float kib = (unsigned long) totalDeletedBytes / pow(1024, 1);
|
||||||
printf(FMT_STR_TOTAL_DELETED_KIBIBYTES, kib);
|
printf(STR_TOTAL_DELETED_KIBIBYTES, kib);
|
||||||
} else if (totalDeletedBytes < (unsigned long) pow(1024, 3)){
|
} else if (totalDeletedBytes < (unsigned long) pow(1024, 3)){
|
||||||
float mib = (unsigned long) totalDeletedBytes / pow(1024, 2);// / (float) 1024 / (float) 1024;
|
float mib = (unsigned long) totalDeletedBytes / pow(1024, 2);// / (float) 1024 / (float) 1024;
|
||||||
printf(FMT_STR_TOTAL_DELETED_MEBIBYTES, mib);
|
printf(STR_TOTAL_DELETED_MEBIBYTES, mib);
|
||||||
} else {
|
} else {
|
||||||
float gib = (unsigned long) totalDeletedBytes / pow(1024, 3);
|
float gib = (unsigned long) totalDeletedBytes / pow(1024, 3);
|
||||||
printf(FMT_STR_TOTAL_DELETED_GIBIBYTES, gib);
|
printf(STR_TOTAL_DELETED_GIBIBYTES, gib);
|
||||||
}
|
}
|
||||||
setConsoleColor(RESET_CONSOLE_COLOR);
|
setConsoleColor(RESET_CONSOLE_COLOR);
|
||||||
}
|
}
|
||||||
|
@ -251,7 +251,7 @@ int main(void){
|
||||||
printf("%s\n%s\n\n", PROGRAM_COPYRIGHT, STR_LN);
|
printf("%s\n%s\n\n", PROGRAM_COPYRIGHT, STR_LN);
|
||||||
|
|
||||||
setConsoleColor(FOREGROUND_INTENSITY | FOREGROUND_YELLOW);
|
setConsoleColor(FOREGROUND_INTENSITY | FOREGROUND_YELLOW);
|
||||||
printf(FMT_STR_TAMPER_WARNING);
|
printf(STR_TAMPER_WARNING);
|
||||||
unsigned int ignoreWarning = GetPrivateProfileInt("Geral", "IgnorarAlerta", 0, PATH_CFG);
|
unsigned int ignoreWarning = GetPrivateProfileInt("Geral", "IgnorarAlerta", 0, PATH_CFG);
|
||||||
unsigned int licenseAccepted = GetPrivateProfileInt("Geral", "AceitarLicença", 0, PATH_CFG);
|
unsigned int licenseAccepted = GetPrivateProfileInt("Geral", "AceitarLicença", 0, PATH_CFG);
|
||||||
if (!ignoreWarning || !licenseAccepted){
|
if (!ignoreWarning || !licenseAccepted){
|
||||||
|
|
26
str.h
26
str.h
|
@ -22,27 +22,27 @@
|
||||||
|
|
||||||
#define STR_LN "--------------------------------------"
|
#define STR_LN "--------------------------------------"
|
||||||
|
|
||||||
#define FMT_STR_TAMPER_WARNING "Este programa é distribuído gratuitamente em <https://github.com/luca0N/ldl3> na licença GNU General Public License versão 3. Você deve ter recebido um arquivo chamado \"LICENSE\" junto com este programa. O arquivo de licença pode ter sido modificado por alguma outra pessoa. Visite <https://www.gnu.org/licenses/> na ocorrência em que o arquivo não seja genuíno.\n"
|
#define STR_TAMPER_WARNING "Este programa é distribuído gratuitamente em <https://github.com/luca0N/ldl3> na licença GNU General Public License versão 3. Você deve ter recebido um arquivo chamado \"LICENSE\" junto com este programa. O arquivo de licença pode ter sido modificado por alguma outra pessoa. Visite <https://www.gnu.org/licenses/> na ocorrência em que o arquivo não seja genuíno.\n"
|
||||||
#define STR_USE_WARNING "Aviso: é recomendado fechar todos os programas abertos antes de utilizar este programa para poder remover mais arquivos temporários. Deseja continuar? (s/n)"
|
#define STR_USE_WARNING "Aviso: é recomendado fechar todos os programas abertos antes de utilizar este programa para poder remover mais arquivos temporários. Deseja continuar? (s/n)"
|
||||||
|
|
||||||
#define STR_FETCHING_ADD_DIRS "Recolhendo pastas adicionais..."
|
#define STR_FETCHING_ADD_DIRS "Recolhendo pastas adicionais..."
|
||||||
|
|
||||||
#define STR_CLEANING_DIR "[Limpando pasta]"
|
#define STR_CLEANING_DIR "[Limpando pasta] %s\n"
|
||||||
#define STR_DELETED_FILE "[Arquivo removido]"
|
#define STR_DELETED_FILE " [Arquivo removido]\n"
|
||||||
#define STR_DELETED_DIR "[Pasta removida]"
|
#define STR_DELETED_DIR "[Pasta removida] %s\n"
|
||||||
#define STR_DIR_COUNT "[Contagem de pastas]"
|
#define STR_DIR_COUNT "[Contagem de pastas] %d\n"
|
||||||
#define STR_FOUND_DIR "[Pasta encontrada]"
|
#define STR_FOUND_DIR "[Pasta encontrada] [%s] %s\n"
|
||||||
#define STR_FOUND_FILE "[Arquivo encontrado]"
|
#define STR_FOUND_FILE "[Arquivo encontrado] %s\n"
|
||||||
#define STR_FOUND_ITEM "[Item encontrado]"
|
#define STR_FOUND_ITEM "[Item encontrado] %s\n"
|
||||||
#define STR_FAILED_DIR_LIST "Um erro ocorreu ao tentar enumerar os arquivos dentro de uma pasta especificada."
|
#define STR_FAILED_DIR_LIST "Um erro ocorreu ao tentar enumerar os arquivos dentro de uma pasta especificada."
|
||||||
#define STR_FAILED_FILE "[Arquivo mantido] Não foi possível apagar este arquivo pelo seguinte erro:"
|
#define STR_FAILED_FILE "[Arquivo mantido] Não foi possível apagar este arquivo pelo seguinte erro:"
|
||||||
#define STR_FAILED_DIR "[Pasta mantida] Não foi possível apagar esta pasta pelo seguinte erro:"
|
#define STR_FAILED_DIR "[Pasta mantida] Não foi possível apagar esta pasta pelo seguinte erro:"
|
||||||
|
|
||||||
#define FMT_STR_OBJECT_COUNT "[Relatório] %u objetos foram apagados com sucesso.\n"
|
#define STR_OBJECT_COUNT "[Relatório] %u objetos foram apagados com sucesso.\n"
|
||||||
#define FMT_STR_TOTAL_DELETED_BYTES "[Relatório] %lu baites ou mais foram liberados."
|
#define STR_TOTAL_DELETED_BYTES "[Relatório] %lu baites ou mais foram liberados."
|
||||||
#define FMT_STR_TOTAL_DELETED_KIBIBYTES "[Relatório] %.2f KiB ou mais foram liberados."
|
#define STR_TOTAL_DELETED_KIBIBYTES "[Relatório] %.2f KiB ou mais foram liberados."
|
||||||
#define FMT_STR_TOTAL_DELETED_MEBIBYTES "[Relatório] %.2f MiB ou mais foram liberados."
|
#define STR_TOTAL_DELETED_MEBIBYTES "[Relatório] %.2f MiB ou mais foram liberados."
|
||||||
#define FMT_STR_TOTAL_DELETED_GIBIBYTES "[Relatório] %.2f GiB ou mais foram liberados."
|
#define STR_TOTAL_DELETED_GIBIBYTES "[Relatório] %.2f GiB ou mais foram liberados."
|
||||||
|
|
||||||
#define STR_MEM_ERR "[Erro fatal] Não foi possível alocar memória. Tente fechar alguns programas abertos e tente novamente."
|
#define STR_MEM_ERR "[Erro fatal] Não foi possível alocar memória. Tente fechar alguns programas abertos e tente novamente."
|
||||||
|
|
||||||
|
|
Reference in New Issue