From dd04e551e626e9f33d15d0376ef6df7b5d3d6cec Mon Sep 17 00:00:00 2001 From: PrikolMen Date: Thu, 15 Jun 2023 00:15:45 +0400 Subject: [PATCH] Few fixes --- lua/gpm/commands.lua | 9 ++++++++- lua/gpm/fs.lua | 8 +++++++- lua/gpm/package.lua | 4 +++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/lua/gpm/commands.lua b/lua/gpm/commands.lua index 22fb704b..3f4cc2ea 100644 --- a/lua/gpm/commands.lua +++ b/lua/gpm/commands.lua @@ -73,6 +73,13 @@ function gpm.Reload( ... ) return end + if SERVER then + net.Start( "GPM.Networking" ) + net.WriteUInt( 2, 3 ) + net.WriteTable( arguments ) + net.Broadcast() + end + local packages, count = {}, 0 for _, searchable in ipairs( arguments ) do if #searchable == 0 then continue end @@ -90,7 +97,7 @@ function gpm.Reload( ... ) logger:Info( "Found %d candidates to reload, reloading...", count ) for pkg in pairs( packages ) do - pkg:Reload() + pkg:Reload( true ) end end diff --git a/lua/gpm/fs.lua b/lua/gpm/fs.lua index 14513843..b9711d8f 100644 --- a/lua/gpm/fs.lua +++ b/lua/gpm/fs.lua @@ -42,7 +42,13 @@ if efsw ~= nil then local pkg = gpm.Packages[ importPath ] if not pkg then return end - pkg:Reload() + local timerName = "GPM.EFSW." .. importPath + timer.Create( timerName, 0.5, 1, function() + timer.Remove( timerName ) + if pkg:IsInstalled() then + pkg:Reload() + end + end ) end ) end diff --git a/lua/gpm/package.lua b/lua/gpm/package.lua index fdf8be22..930b5a8b 100644 --- a/lua/gpm/package.lua +++ b/lua/gpm/package.lua @@ -888,7 +888,9 @@ do self:ClearCallbacks() end - gpm.Packages[ self:GetImportPath() ] = nil + local importPath = self:GetImportPath() + gpm.ImportTasks[ importPath ] = nil + gpm.Packages[ importPath ] = nil self.Installed = nil logger:Info( "Package '%s' was successfully uninstalled, took %.4f seconds.", self:GetIdentifier(), SysTime() - stopwatch )