Skip to content

Commit cb996e9

Browse files
committed
Removed errors on attempting to delete files which did not exist. (Though the function still returns false in these cases)
1 parent fee5ef4 commit cb996e9

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

xivModdingFramework/Mods/Modding.cs

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -471,11 +471,7 @@ where mod.fullPath.Equals(modItemPath)
471471
if (modToRemove.source == "FilesAddedByTexTools")
472472
{
473473
var index = new Index(_gameDirectory);
474-
var success = await index.DeleteFileDescriptor(modItemPath, XivDataFiles.GetXivDataFile(modToRemove.datFile));
475-
if(!success)
476-
{
477-
throw new Exception("Failed to delete file descriptor.");
478-
}
474+
await index.DeleteFileDescriptor(modItemPath, XivDataFiles.GetXivDataFile(modToRemove.datFile));
479475
}
480476
if (modToRemove.enabled)
481477
{
@@ -523,11 +519,7 @@ where modPack.name.Equals(modPackName)
523519
if (modToRemove.source == "FilesAddedByTexTools")
524520
{
525521
var index = new Index(_gameDirectory);
526-
var success = await index.DeleteFileDescriptor(modToRemove.fullPath, XivDataFiles.GetXivDataFile(modToRemove.datFile));
527-
if (!success)
528-
{
529-
throw new Exception("Failed to delete file descriptor.");
530-
}
522+
await index.DeleteFileDescriptor(modToRemove.fullPath, XivDataFiles.GetXivDataFile(modToRemove.datFile));
531523
}
532524
if (modToRemove.enabled)
533525
{

xivModdingFramework/SqPack/FileTypes/Index.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ public async Task<bool> DeleteFileDescriptor(string fullPath, XivDataFile dataFi
903903
}
904904
}
905905

906-
// Cancel if we failed to find the file.
906+
// If the file was already deleted, nothing to do here.
907907
if (deleteLocation == 0)
908908
{
909909
_semaphoreSlim.Release();
@@ -976,9 +976,11 @@ public async Task<bool> DeleteFileDescriptor(string fullPath, XivDataFile dataFi
976976

977977
if (!foundFolder)
978978
{
979-
// Something went wrong here / The index is in a bad state.
980-
_semaphoreSlim.Release();
981-
return false;
979+
// This is a pretty weird state to get here.
980+
// The file had to exist, but the folder it was in had to *not* exist.
981+
// This is tentatively a non-error, as we should really continue and purge the
982+
// Index2 Entry for the file as well, but it's definitely a weird/invalid index state
983+
// that got us here.
982984
}
983985

984986

0 commit comments

Comments
 (0)