From effda5d66fedcf07909a885167d70176d2fc1a0e Mon Sep 17 00:00:00 2001 From: panda Date: Tue, 12 Nov 2024 16:29:08 +0800 Subject: [PATCH] create typing when not exists --- unreal/Puerts/Source/JsEnv/JsEnv.Build.cs | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/unreal/Puerts/Source/JsEnv/JsEnv.Build.cs b/unreal/Puerts/Source/JsEnv/JsEnv.Build.cs index 2e75e5d0ac..390873f6a3 100644 --- a/unreal/Puerts/Source/JsEnv/JsEnv.Build.cs +++ b/unreal/Puerts/Source/JsEnv/JsEnv.Build.cs @@ -182,15 +182,13 @@ public JsEnv(ReadOnlyTargetRules Target) : base(Target) "ffi/index.d.ts" }; destDirName = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "..", "..", "Typing")); - if(Directory.Exists(destDirName)) + Directory.CreateDirectory(destDirName); // create when not exists, otherwise skip it + foreach (var Source in SourceFiles) { - foreach (var Source in SourceFiles) - { - string src = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Typing", Source)); - string dest = Path.GetFullPath(Path.Combine(destDirName, Source)); - // Logger.LogDebug("Copy " + Source + " from " + src + " to " + dest); - File.Copy(src, dest, true); - } + string src = Path.GetFullPath(Path.Combine(ModuleDirectory, "..", "..", "Typing", Source)); + string dest = Path.GetFullPath(Path.Combine(destDirName, Source)); + // Logger.LogDebug("Copy " + Source + " from " + src + " to " + dest); + File.Copy(src, dest, true); } }