Skip to content

Commit

Permalink
fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
James committed Oct 12, 2023
1 parent b4c98e7 commit 7f165b6
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions plugin/src/lua/plugin/Vendor/Core/VersionController.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 7f165b6

Please sign in to comment.