Browse Source

Fixed export filename crash

Krzysztof Krysiński 2 years ago
parent
commit
a13a6a5513
1 changed files with 7 additions and 1 deletions
  1. 7 1
      src/PixiEditor/ViewModels/SaveFilePopupViewModel.cs

+ 7 - 1
src/PixiEditor/ViewModels/SaveFilePopupViewModel.cs

@@ -59,13 +59,19 @@ internal class SaveFilePopupViewModel : ViewModelBase
             Title = "Export path",
             Title = "Export path",
             CheckPathExists = true,
             CheckPathExists = true,
             Filter = SupportedFilesHelper.BuildSaveFilter(false),
             Filter = SupportedFilesHelper.BuildSaveFilter(false),
-            FilterIndex = 0
+            FilterIndex = 0,
+            AddExtension = true
         };
         };
         if (path.ShowDialog() == true)
         if (path.ShowDialog() == true)
         {
         {
             if (string.IsNullOrEmpty(path.FileName) == false)
             if (string.IsNullOrEmpty(path.FileName) == false)
             {
             {
                 ChosenFormat = SupportedFilesHelper.ParseImageFormat(Path.GetExtension(path.SafeFileName));
                 ChosenFormat = SupportedFilesHelper.ParseImageFormat(Path.GetExtension(path.SafeFileName));
+                if (ChosenFormat == FileType.Unset)
+                {
+                    ChosenFormat = FileType.Png;
+                    path.FileName += ".png";
+                }
                 return path.FileName;
                 return path.FileName;
             }
             }
         }
         }