mirror of
https://github.com/Thealexbarney/LibHac.git
synced 2024-11-14 10:49:41 +01:00
hactoolnet: Savefile fixes
Only open as writable if needed Only commit if needed
This commit is contained in:
parent
7b8c3f0b4f
commit
b03973dc48
1 changed files with 14 additions and 2 deletions
|
@ -14,7 +14,15 @@ namespace hactoolnet
|
||||||
{
|
{
|
||||||
public static void Process(Context ctx)
|
public static void Process(Context ctx)
|
||||||
{
|
{
|
||||||
using (var file = new LocalStorage(ctx.Options.InFile, FileAccess.ReadWrite))
|
FileAccess accessNeeded = FileAccess.Read;
|
||||||
|
|
||||||
|
if (ctx.Options.SignSave || ctx.Options.ReplaceFileDest != null && ctx.Options.ReplaceFileSource != null ||
|
||||||
|
ctx.Options.RepackSource != null || ctx.Options.TrimSave)
|
||||||
|
{
|
||||||
|
accessNeeded = FileAccess.ReadWrite;
|
||||||
|
}
|
||||||
|
|
||||||
|
using (var file = new LocalStorage(ctx.Options.InFile, accessNeeded))
|
||||||
{
|
{
|
||||||
bool signNeeded = ctx.Options.SignSave;
|
bool signNeeded = ctx.Options.SignSave;
|
||||||
|
|
||||||
|
@ -86,7 +94,11 @@ namespace hactoolnet
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
{
|
{
|
||||||
save.Commit(ctx.Keyset);
|
if (signNeeded)
|
||||||
|
{
|
||||||
|
save.Commit(ctx.Keyset);
|
||||||
|
signNeeded = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.Options.TrimSave)
|
if (ctx.Options.TrimSave)
|
||||||
|
|
Loading…
Reference in a new issue