Bladeren bron

Added Paths.PathToUnsavedFilesFolder

CPKreuz 1 jaar geleden
bovenliggende
commit
5a02a7d0b7

+ 16 - 1
src/PixiEditor/Models/IO/Paths.cs

@@ -4,9 +4,24 @@ using System.Reflection;
 namespace PixiEditor.Models.IO;
 public static class Paths
 {
+    /// <summary>
+    /// Path to {installation folder}/Data
+    /// </summary>
     public static string DataFullPath { get; } = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Data");
+    /// <summary>
+    /// Path to {installation folder}/Extensions
+    /// </summary>
     public static string ExtensionsFullPath { get; } = Path.Combine(Path.GetDirectoryName(Assembly.GetEntryAssembly().Location), "Extensions");
+    /// <summary>
+    /// Path to %localappdata%/PixiEditor/Palettes
+    /// </summary>
     public static string PathToPalettesFolder { get; } = Path.Join(
         Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
-        "PixiEditor", "Palettes");
+        "PixiEditor", "Autosave");
+    /// <summary>
+    /// Path to %temp%/PixiEditor/Autosave
+    /// </summary>
+    public static string PathToUnsavedFilesFolder { get; } = Path.Join(
+        Path.GetTempPath(),
+        "PixiEditor", "Autosave");
 }

+ 1 - 3
src/PixiEditor/ViewModels/SubViewModels/Document/AutosaveDocumentViewModel.cs

@@ -209,8 +209,6 @@ internal class AutosaveDocumentViewModel : NotifyableObject
         }
     }
     
-    private string GetTempPath() => Path.Combine(Path.GetTempPath(), "PixiEditor", "autosave", $"autosave-{tempGuid}.pixi");
-
     private void Autosave()
     {
         saveAfterNextFinish = false;
@@ -222,7 +220,7 @@ internal class AutosaveDocumentViewModel : NotifyableObject
 
         if (Document.FullFilePath == null || !Document.FullFilePath.EndsWith(".pixi"))
         {
-            filePath = GetTempPath();
+            filePath = Path.Join(Paths.PathToUnsavedFilesFolder, $"autosave-{tempGuid}.pixi");
             Directory.CreateDirectory(Directory.GetParent(filePath)!.FullName);
         }
         else