mirror of
https://github.com/kwsch/PKHeX
synced 2025-02-17 13:58:33 +00:00
Add write protection err handling
yay sd cards getting switched accidentally
This commit is contained in:
parent
7048b012d3
commit
29a1a83b07
1 changed files with 10 additions and 3 deletions
|
@ -3131,9 +3131,16 @@ namespace PKHeX
|
|||
SAV.CurrentBox = CB_BoxSelect.SelectedIndex;
|
||||
|
||||
bool dsv = Path.GetExtension(main.FileName)?.ToLower() == ".dsv";
|
||||
File.WriteAllBytes(main.FileName, SAV.Write(dsv));
|
||||
SAV.Edited = false;
|
||||
Util.Alert("SAV exported to:", main.FileName);
|
||||
try
|
||||
{
|
||||
File.WriteAllBytes(main.FileName, SAV.Write(dsv));
|
||||
SAV.Edited = false;
|
||||
Util.Alert("SAV exported to:", main.FileName);
|
||||
}
|
||||
catch (UnauthorizedAccessException x)
|
||||
{
|
||||
Util.Error(x.Message, "If destination is a removable disk (SD card), please ensure the write protection switch is not set.");
|
||||
}
|
||||
}
|
||||
|
||||
// Box/SAV Functions //
|
||||
|
|
Loading…
Add table
Reference in a new issue