Commit 23842733 by Matt Mascarenhas

cinera.c: Generate index if any files changed

Previously it could fail to generate an index if the processing of the final file set "Inserted" or "Deleted" to FALSE, even if a prior file had set it to TRUE
parent fc7c28c0
......@@ -16,7 +16,7 @@ typedef struct
version CINERA_APP_VERSION = {
.Major = 0,
.Minor = 5,
.Patch = 54
.Patch = 55
};
// TODO(matt): Copy in the DB 3 stuff from cinera_working.c
......@@ -5841,11 +5841,11 @@ MonitorDirectory(index *Index, buffers *CollationBuffers, template *IndexTemplat
// TODO(matt): Maybe handle IN_ALL_EVENTS
if(FinalFileEvents[FinalFileEventsIndex]->mask & IN_DELETE || FinalFileEvents[FinalFileEventsIndex]->mask & IN_MOVED_FROM)
{
Deleted = (DeleteEntry(Index, &Neighbourhood, FinalFileEvents[FinalFileEventsIndex]->name) == RC_SUCCESS);
Deleted |= (DeleteEntry(Index, &Neighbourhood, FinalFileEvents[FinalFileEventsIndex]->name) == RC_SUCCESS);
}
else
{
Inserted = (InsertEntry(Index, &Neighbourhood, CollationBuffers, PlayerTemplate, BespokeTemplate, FinalFileEvents[FinalFileEventsIndex]->name, 0) == RC_SUCCESS);
Inserted |= (InsertEntry(Index, &Neighbourhood, CollationBuffers, PlayerTemplate, BespokeTemplate, FinalFileEvents[FinalFileEventsIndex]->name, 0) == RC_SUCCESS);
}
}
......@@ -6206,10 +6206,7 @@ int
SyncIndexWithInput(index *Index, buffers *CollationBuffers, template *IndexTemplate, template *PlayerTemplate, template *BespokeTemplate)
{
bool Deleted = FALSE;
if(Index->Metadata.FileSize > 0 && Index->File.FileSize > 0 && DeleteDeadIndexEntries(Index) == RC_SUCCESS)
{
Deleted = TRUE;
}
Deleted = (Index->Metadata.FileSize > 0 && Index->File.FileSize > 0 && DeleteDeadIndexEntries(Index) == RC_SUCCESS);
DIR *ProjectDirHandle;
if(!(ProjectDirHandle = opendir(Config.ProjectDir)))
......@@ -6232,7 +6229,7 @@ SyncIndexWithInput(index *Index, buffers *CollationBuffers, template *IndexTempl
neighbourhood Neighbourhood = { };
Neighbourhood.PrevIndex = -1;
Neighbourhood.NextIndex = -1;
Inserted = (InsertEntry(Index, &Neighbourhood, CollationBuffers, PlayerTemplate, BespokeTemplate, ProjectFiles->d_name, 0) == RC_SUCCESS);
Inserted |= (InsertEntry(Index, &Neighbourhood, CollationBuffers, PlayerTemplate, BespokeTemplate, ProjectFiles->d_name, 0) == RC_SUCCESS);
}
}
closedir(ProjectDirHandle);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment