Skip to content

Commit

Permalink
Few fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown-gd committed Jun 14, 2023
1 parent e48fac4 commit dd04e55
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
9 changes: 8 additions & 1 deletion lua/gpm/commands.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down
8 changes: 7 additions & 1 deletion lua/gpm/fs.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 3 additions & 1 deletion lua/gpm/package.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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 )
Expand Down

0 comments on commit dd04e55

Please sign in to comment.