From 7f165b6b2477c7a262cdf2b39a4802809e2a8ecc Mon Sep 17 00:00:00 2001 From: James Date: Wed, 11 Oct 2023 23:49:44 -0500 Subject: [PATCH] fix error --- .../plugin/Vendor/Core/VersionController.lua | 32 +++++++++++++------ 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/plugin/src/lua/plugin/Vendor/Core/VersionController.lua b/plugin/src/lua/plugin/Vendor/Core/VersionController.lua index 8e8b1a85..cc8c2f19 100644 --- a/plugin/src/lua/plugin/Vendor/Core/VersionController.lua +++ b/plugin/src/lua/plugin/Vendor/Core/VersionController.lua @@ -44,16 +44,27 @@ local RequiredEngineInstances = { } local FolderToService = { - EngineClient = ReplicatedStorage, - EngineReplicated = ReplicatedStorage, - EngineReplicatedFirst = ReplicatedFirst, - EngineServer = ServerStorage, + Client = ReplicatedStorage, + Replicated = ReplicatedStorage, + ReplicatedFirst = ReplicatedFirst, + Server = ServerStorage, } VersionController.DataUpdated = Signal.new() -- // Functions +function VersionController.IsOldVersionInstalled(): boolean + local CurrentInstance = VersionController.GetCurrentInstance() + + if CurrentInstance.Framework and not (CurrentInstance.Client or CurrentInstance.Server or CurrentInstance.ReplicatedFirst or CurrentInstance.Replicated) then + WindowController.SetMessageWindow("An old version of the framework is installed, and older versions are no longer supported. You will have to update manually.", ERROR_COLOR) + return true + end + + return false +end + function VersionController.GetDirectoryFromStructureJSON(json: {any}, parent: Instance, isPackage: boolean?) for instanceName, children in json do if instanceName == "$parent" then @@ -120,11 +131,11 @@ function VersionController.GetCurrentInstance(ignoreNil: boolean?): {[string]: F ignoreNil = ignoreNil or false local EngineTable = { - Server = ServerStorage:FindFirstChild("Server") or ServerStorage:FindFirstChild("EngineServer"), - Client = ReplicatedStorage:FindFirstChild("Client") or ReplicatedStorage:FindFirstChild("EngineClient"), - Replicated = ReplicatedStorage:FindFirstChild("Replicated") or ReplicatedStorage:FindFirstChild("EngineReplicated"), + Server = ServerStorage:FindFirstChild("Server"), + Client = ReplicatedStorage:FindFirstChild("Client"), + Replicated = ReplicatedStorage:FindFirstChild("Replicated"), Framework = ReplicatedStorage:FindFirstChild("Framework") or ReplicatedStorage:FindFirstChild("CanaryEngineFramework"), - ReplicatedFirst = ReplicatedFirst:FindFirstChild("PriorityLoad") or ReplicatedFirst:FindFirstChild("EngineReplicatedFirst") + ReplicatedFirst = ReplicatedFirst:FindFirstChild("PriorityLoad") } if not ignoreNil then @@ -165,8 +176,7 @@ function VersionController.UpdateFramework() return end - if CurrentInstance.Framework and not (CurrentInstance.Client or CurrentInstance.Server or CurrentInstance.ReplicatedFirst or CurrentInstance.Replicated) then - WindowController.SetMessageWindow("An old version of the framework is installed, and older versions are no longer supported. You will have to update manually.", ERROR_COLOR) + if VersionController.IsOldVersionInstalled() then return end @@ -307,6 +317,8 @@ function VersionController.InstallFramework() StructureCache.Framework.Parent = ReplicatedStorage ReplicatedFirst:SetAttribute("EngineLoaderEnabled", false) + task.wait(0.5) + local NewInstance = VersionController.GetCurrentInstance() if not CanaryStudioSettings.CanaryStudioInstaller["Enable Asset Templates"] then