From 0220e4836082cd6ed40cb91681c85705be4d9079 Mon Sep 17 00:00:00 2001 From: Elivo Date: Thu, 28 Aug 2025 12:07:29 +0800 Subject: [PATCH] =?UTF-8?q?WriteFile=20=E8=87=AA=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=9B=AE=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Apewer/StorageUtility.cs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Apewer/StorageUtility.cs b/Apewer/StorageUtility.cs index 63d0b42..9dce080 100644 --- a/Apewer/StorageUtility.cs +++ b/Apewer/StorageUtility.cs @@ -437,6 +437,9 @@ namespace Apewer { try { + var dir = Path.GetDirectoryName(path); + if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); + File.WriteAllBytes(path, TextUtility.Bom); return true; } @@ -451,6 +454,9 @@ namespace Apewer var success = false; try { + var dir = Path.GetDirectoryName(path); + if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); + var write1 = BytesUtility.Write(file, TextUtility.Bom); if (write1 == TextUtility.Bom.Length) { @@ -474,6 +480,9 @@ namespace Apewer { try { + var dir = Path.GetDirectoryName(path); + if (!Directory.Exists(dir)) Directory.CreateDirectory(dir); + File.WriteAllBytes(path, bytes); return true; }