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;
|
||||||
|
|
||||||
|
@ -85,8 +93,12 @@ namespace hactoolnet
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
finally
|
finally
|
||||||
|
{
|
||||||
|
if (signNeeded)
|
||||||
{
|
{
|
||||||
save.Commit(ctx.Keyset);
|
save.Commit(ctx.Keyset);
|
||||||
|
signNeeded = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ctx.Options.TrimSave)
|
if (ctx.Options.TrimSave)
|
||||||
|
|
Loading…
Reference in a new issue