Prevent saving invalid files

This commit is contained in:
ackwell 2024-05-03 21:15:00 +10:00
parent 2e76148fba
commit c96adcf557

View file

@ -204,8 +204,9 @@ public class FileEditor<T>(
private void SaveButton()
{
var canSave = _changed && _currentFile != null && _currentFile.Valid;
if (ImGuiUtil.DrawDisabledButton("Save to File", Vector2.Zero,
$"Save the selected {fileType} file with all changes applied. This is not revertible.", !_changed))
$"Save the selected {fileType} file with all changes applied. This is not revertible.", !canSave))
{
compactor.WriteAllBytes(_currentPath!.File.FullName, _currentFile!.Write());
if (owner.Mod != null)