fixed log folder counting bug
gonna make this variable, don't worry
This commit is contained in:
parent
2d233ea54e
commit
5054284370
@ -21,8 +21,11 @@ int initLogger(char *directoryPath)
|
||||
int buffer = 1;
|
||||
int returning;
|
||||
char *filePath = malloc(strlen(directoryPath) + strlen(LOG_FORMAT) + 1);
|
||||
char *dateBuffer = malloc(strlen("yyyy-mm-dd") + 17); //TODO: MAKE THIS VARIABLE; FIND OUT WHY TF YOU NEED 17 MORE BYTES
|
||||
DIR *dir;
|
||||
|
||||
sprintf(dateBuffer, "%04d-%02d-%02d", tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday);
|
||||
|
||||
//CREATE directoryPath DIRECTORY IF IT DOESN'T EXISTS ALREADY
|
||||
if (stat(directoryPath, &st) == -1)
|
||||
{
|
||||
@ -35,9 +38,7 @@ int initLogger(char *directoryPath)
|
||||
{
|
||||
if (entry -> d_type == DT_REG)
|
||||
{
|
||||
if (strcmp(entry -> d_name, ".gitkeep") == 0) continue;
|
||||
|
||||
buffer++;
|
||||
if (strncmp(dateBuffer, entry -> d_name, strlen(dateBuffer)) == 0) buffer++;
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,6 +50,7 @@ int initLogger(char *directoryPath)
|
||||
|
||||
//DEALLOCATION
|
||||
free(filePath);
|
||||
free(dateBuffer);
|
||||
closedir(dir);
|
||||
|
||||
return returning;
|
||||
|
Loading…
x
Reference in New Issue
Block a user