Skip to content

Commit

Permalink
Fix crash on export + "unsaved changes" on export
Browse files Browse the repository at this point in the history
  • Loading branch information
Snoozeds committed Jan 6, 2025
1 parent b02232a commit 6d00356
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/UnrealLocresEditor/Views/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -790,12 +790,13 @@ private void SaveMenuItem_Click(object sender, RoutedEventArgs e)
public void SaveEditedData()
{

if (_currentLocresFilePath == null)
{
if(string.IsNullOrEmpty(_currentLocresFilePath))
{
_notificationManager.Show(new Notification("Error", "No file is currently open to save.", NotificationType.Error));
return;
}

var exeDirectory = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
var exeDirectory = AppContext.BaseDirectory;
var csvFileName = Path.GetFileNameWithoutExtension(_currentLocresFilePath) + "_edited.csv";
var csvFile = Path.Combine(exeDirectory, csvFileName);

Expand Down Expand Up @@ -851,6 +852,7 @@ public void SaveEditedData()
File.Move(modifiedLocres, destinationFile);

_notificationManager.Show(new Notification("Success!", $"File saved as {Path.GetFileName(destinationFile)} in {destinationDirectory}", NotificationType.Success));
_hasUnsavedChanges = false;
}
catch (Exception ex)
{
Expand Down

0 comments on commit 6d00356

Please sign in to comment.