From e0b739549b87263c007915bc200e0837fa156445 Mon Sep 17 00:00:00 2001 From: lilxyzw Date: Thu, 12 Dec 2024 22:41:26 +0900 Subject: [PATCH] chore: avoid warning --- Assets/lilToon/Editor/lilOptimizer.cs | 8 ++++++++ Assets/lilToon/Editor/lilToonSetting.cs | 9 ++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/Assets/lilToon/Editor/lilOptimizer.cs b/Assets/lilToon/Editor/lilOptimizer.cs index f2efe116..554a8083 100644 --- a/Assets/lilToon/Editor/lilOptimizer.cs +++ b/Assets/lilToon/Editor/lilOptimizer.cs @@ -192,9 +192,13 @@ private static void RewriteInputHLSL(Dictionary dicT, Dictionar { string optHLSL = RewriteInputHLSLText(dicT, dicD, dicF, dicC); string pathOpt = AssetDatabase.GUIDToAssetPath("571051a232e4af44a98389bda858df27"); + var fi = new FileInfo(pathOpt); + var timeC = fi.CreationTime; + var timeW = fi.LastWriteTime; var sw = new StreamWriter(pathOpt, false); sw.Write(optHLSL); sw.Close(); + new FileInfo(pathOpt){CreationTime = timeC, LastWriteTime = timeW}; } private static string RewriteInputHLSLText(Dictionary dicT, Dictionary dicD, Dictionary dicF, Dictionary dicC) @@ -315,11 +319,15 @@ internal static void ResetInputHLSL() string pathBase = AssetDatabase.GUIDToAssetPath("8ff7f7d9c86e1154fb3aac5a8a8681bb"); string pathOpt = AssetDatabase.GUIDToAssetPath("571051a232e4af44a98389bda858df27"); if(string.IsNullOrEmpty(pathBase) || string.IsNullOrEmpty(pathOpt) || !File.Exists(pathBase) || !File.Exists(pathOpt)) return; + var fi = new FileInfo(pathOpt); + var timeC = fi.CreationTime; + var timeW = fi.LastWriteTime; var sw = new StreamWriter(pathOpt, false); var sr = new StreamReader(pathBase); sw.Write(sr.ReadToEnd()); sw.Close(); sr.Close(); + new FileInfo(pathOpt){CreationTime = timeC, LastWriteTime = timeW}; } private static string GetIndent(int indent) diff --git a/Assets/lilToon/Editor/lilToonSetting.cs b/Assets/lilToon/Editor/lilToonSetting.cs index c39d2388..56b6428f 100644 --- a/Assets/lilToon/Editor/lilToonSetting.cs +++ b/Assets/lilToon/Editor/lilToonSetting.cs @@ -511,7 +511,14 @@ internal static void ApplyShaderSetting(lilToonSetting shaderSetting, string rep if(shaderPath.Contains(".lilcontainer")) continue; string baseShaderPath = baseShaderFolderPath + Path.AltDirectorySeparatorChar + Path.GetFileNameWithoutExtension(shaderPath) + ".lilinternal"; - if(File.Exists(baseShaderPath)) File.WriteAllText(shaderPath, lilShaderContainer.UnpackContainer(baseShaderPath, null, doOptimize)); + if(!File.Exists(baseShaderPath)) continue; + + // Change without updating FileInfo + var fi = new FileInfo(shaderPath); + var timeC = fi.CreationTime; + var timeW = fi.LastWriteTime; + File.WriteAllText(shaderPath, lilShaderContainer.UnpackContainer(baseShaderPath, null, doOptimize)); + new FileInfo(shaderPath){CreationTime = timeC, LastWriteTime = timeW}; } foreach(var shaderPath in shaderPathes) {