Skip to content

Commit

Permalink
Few fixes/changes
Browse files Browse the repository at this point in the history
  • Loading branch information
unknown-gd committed May 25, 2023
1 parent 0135725 commit 0b03f15
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 12 deletions.
4 changes: 2 additions & 2 deletions lua/gpm/package.lua
Original file line number Diff line number Diff line change
Expand Up @@ -296,9 +296,9 @@ Initialize = promise.Async( function( metadata, func, files )
if type( func ) ~= "function" then
local currentFile = utils.GetCurrentFile()
if currentFile then
local folder = string.GetPathFromFilename( paths.Localize( currentFile ) )
local folder = paths.Localize( string.GetPathFromFilename( currentFile ) )
if folder then
local filePath = paths.Fix( folder .. fileName )
local filePath = folder .. fileName
if fs.IsFile( filePath, luaRealm ) then
func = gpm.CompileLua( filePath ):Await()
end
Expand Down
10 changes: 5 additions & 5 deletions lua/gpm/sources/gma.lua
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,17 @@ Import = promise.Async( function( metadata )
importPaths[ #importPaths + 1 ] = importPath
end

local results = {}
local packages = {}
for _, importPath in ipairs( importPaths ) do
results[ #results + 1 ] = gpm.SourceImport( "lua", importPath )
packages[ #packages + 1 ] = gpm.SourceImport( "lua", importPath ):Await()
end

local count = #results
local count = #packages
if count > 0 then
if count == 1 then
return results[ 1 ]
return packages[ 1 ]
end

return results
return packages
end
end )
14 changes: 9 additions & 5 deletions lua/gpm/sources/lua.lua
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ GetMetadata = promise.Async( function( importPath )
metadata = package.GetMetadata( result )
end

-- For single file
-- Single file
if not metadata then
metadata = {
["autorun"] = true
Expand All @@ -73,7 +73,9 @@ GetMetadata = promise.Async( function( importPath )

-- Shared init
local main = metadata.main
if type( main ) ~= "string" then
if type( main ) == "string" then
main = paths.Fix( main )
else
main = "init.lua"
end

Expand All @@ -89,14 +91,16 @@ GetMetadata = promise.Async( function( importPath )
end

if fs.IsFile( main, luaRealm ) then
metadata.main = paths.Fix( main )
metadata.main = main
else
metadata.main = nil
end

-- Client init
local cl_main = metadata.cl_main
if type( cl_main ) ~= "string" then
if type( cl_main ) == "string" then
cl_main = paths.Fix( cl_main )
else
cl_main = "cl_init.lua"
end

Expand All @@ -108,7 +112,7 @@ GetMetadata = promise.Async( function( importPath )
end

if fs.IsFile( cl_main, luaRealm ) then
metadata.cl_main = paths.Fix( cl_main )
metadata.cl_main = cl_main
else
metadata.cl_main = nil
end
Expand Down

0 comments on commit 0b03f15

Please sign in to comment.