From 18b39b9f72fc290d4c1f24fb2adc74bac4f1b308 Mon Sep 17 00:00:00 2001 From: Matt Mascarenhas Date: Sun, 10 May 2020 17:32:44 +0100 Subject: [PATCH] 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. --- cinera/cinera.c | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/cinera/cinera.c b/cinera/cinera.c index 82aa0ed..47b6d55 100644 --- a/cinera/cinera.c +++ b/cinera/cinera.c @@ -17,7 +17,7 @@ typedef struct version CINERA_APP_VERSION = { .Major = 0, .Minor = 7, - .Patch = 3 + .Patch = 4 }; #include // NOTE(matt): varargs @@ -8577,21 +8577,9 @@ DeletePlayerPageFromFilesystem(db_header_project *P, string EntryOutput, bool Re { 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)); - - fprintf(stderr, "%sMostly deleted%s ", ColourStrings[EditTypes[EDIT_DELETION].Colour], ColourStrings[CS_END]); - 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); - } - + LogError(LOG_NOTICE, "Unable to remove directory %s: %s", OutputDirectoryPath, strerror(errno)); + fprintf(stderr, "\n" + " %sUnable to remove directory%s %s: %s\n", ColourStrings[CS_ERROR], ColourStrings[CS_END], OutputDirectoryPath, strerror(errno)); } } } @@ -12001,6 +11989,10 @@ DeleteFromDB(neighbourhood *N, string BaseFilename) fwrite(DB.File.Buffer.Location + DeleteFileTo, DB.File.Buffer.Size - DeleteFileTo, 1, DB.File.Handle); 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;