-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #201 from project-fika/fix/patch-VFS
Fix/patch VFS
- Loading branch information
Showing
3 changed files
with
37 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using SPT.Reflection.Patching; | ||
using System.Reflection; | ||
using SPT.Common.Utils; | ||
|
||
namespace Fika.Core.Coop.Patches.SPTBugs | ||
{ | ||
// This patch fixes a bug in SPT 3.10.0 where SPT's git history was out of date thus causing it to run this code early. | ||
// It will be fixed in SPT 3.10.1, but to keep backwards compatibility keep this patch in until 3.11 for players that refuse to update their SPT version. | ||
internal class FixVFSDeleteFilePatch : ModulePatch | ||
{ | ||
protected override MethodBase GetTargetMethod() | ||
{ | ||
return typeof(VFS).GetMethod(nameof(VFS.DeleteFile)); | ||
} | ||
|
||
[PatchPrefix] | ||
public static bool Prefix(string filepath) | ||
{ | ||
if (VFS.Exists(filepath)) | ||
{ | ||
// Run the orginal method. | ||
return true; | ||
} | ||
|
||
// Skip method | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters