cinera.c: Always print entry deletion from DB

Previously we only printed deletion in DeletePlayerPageFromFilesystem().
If, however, the output parameter is set in a .hmml file, we needn't
delete that page from filesystem. What would happen is, we move the
file from one location (delete) to another (insert / append), and only
printed out the insertion / append. This gave the impression that the
old database entry remained, when it had correctly been deleted.
This commit is contained in:
Matt Mascarenhas 2020-05-10 17:32:44 +01:00
parent f20a35e0de
commit 18b39b9f72
1 changed files with 8 additions and 16 deletions

View File

@ -17,7 +17,7 @@ typedef struct
version CINERA_APP_VERSION = { version CINERA_APP_VERSION = {
.Major = 0, .Major = 0,
.Minor = 7, .Minor = 7,
.Patch = 3 .Patch = 4
}; };
#include <stdarg.h> // NOTE(matt): varargs #include <stdarg.h> // NOTE(matt): varargs
@ -8577,21 +8577,9 @@ DeletePlayerPageFromFilesystem(db_header_project *P, string EntryOutput, bool Re
{ {
if(RemovalSuccess == -1) if(RemovalSuccess == -1)
{ {
LogError(LOG_NOTICE, "Mostly deleted %.*s/%.*s. Unable to remove directory %s: %s", (int)CurrentProject->Lineage.Length, CurrentProject->Lineage.Base, (int)EntryOutput.Length, EntryOutput.Base, OutputDirectoryPath, strerror(errno)); LogError(LOG_NOTICE, "Unable to remove directory %s: %s", OutputDirectoryPath, strerror(errno));
fprintf(stderr, "\n"
fprintf(stderr, "%sMostly deleted%s ", ColourStrings[EditTypes[EDIT_DELETION].Colour], ColourStrings[CS_END]); " %sUnable to remove directory%s %s: %s\n", ColourStrings[CS_ERROR], ColourStrings[CS_END], OutputDirectoryPath, strerror(errno));
PrintLineageAndEntryID(CurrentProject->Lineage, EntryOutput, TRUE);
fprintf(stderr, " %sUnable to remove directory%s %s: %s\n", ColourStrings[CS_ERROR], ColourStrings[CS_END], OutputDirectoryPath, strerror(errno));
}
else
{
if(!Relocating)
{
LogError(LOG_INFORMATIONAL, "Deleted %.*s/%.*s", (int)CurrentProject->Lineage.Length, CurrentProject->Lineage.Base, (int)EntryOutput.Length, EntryOutput.Base);
fprintf(stderr, "%s%s%s ", ColourStrings[EditTypes[EDIT_DELETION].Colour], EditTypes[EDIT_DELETION].Name, ColourStrings[CS_END]);
PrintLineageAndEntryID(CurrentProject->Lineage, EntryOutput, TRUE);
}
} }
} }
} }
@ -12001,6 +11989,10 @@ DeleteFromDB(neighbourhood *N, string BaseFilename)
fwrite(DB.File.Buffer.Location + DeleteFileTo, DB.File.Buffer.Size - DeleteFileTo, 1, DB.File.Handle); fwrite(DB.File.Buffer.Location + DeleteFileTo, DB.File.Buffer.Size - DeleteFileTo, 1, DB.File.Handle);
CycleFile(&DB.File); CycleFile(&DB.File);
} }
LogError(LOG_INFORMATIONAL, "Deleted %.*s/%.*s", (int)CurrentProject->Lineage.Length, CurrentProject->Lineage.Base, (int)BaseFilename.Length, BaseFilename.Base);
fprintf(stderr, "%s%s%s ", ColourStrings[EditTypes[EDIT_DELETION].Colour], EditTypes[EDIT_DELETION].Name, ColourStrings[CS_END]);
PrintLineageAndEntryID(CurrentProject->Lineage, BaseFilename, TRUE);
} }
return Entry ? RC_SUCCESS : RC_NOOP; return Entry ? RC_SUCCESS : RC_NOOP;