mirror of
https://github.com/lifestorm/wnsrc.git
synced 2025-12-16 21:33:46 +03:00
Upload
This commit is contained in:
42
lua/menu/util.lua
Normal file
42
lua/menu/util.lua
Normal file
@@ -0,0 +1,42 @@
|
||||
--[[
|
||||
| This file was obtained through the combined efforts
|
||||
| of Madbluntz & Plymouth Antiquarian Society.
|
||||
|
|
||||
| Credits: lifestorm, Gregory Wayne Rossel JR.,
|
||||
| Maloy, DrPepper10 @ RIP, Atle!
|
||||
|
|
||||
| Visit for more: https://plymouth.thetwilightzone.ru/
|
||||
--]]
|
||||
|
||||
|
||||
concommand.Add( "whereis", function( _, _, _, path )
|
||||
|
||||
local absolutePath = util.RelativePathToFull_Menu( path, "GAME" )
|
||||
|
||||
if ( !absolutePath or !file.Exists( path, "GAME" ) ) then
|
||||
MsgN "File not found."
|
||||
return
|
||||
end
|
||||
|
||||
local relativePath = util.FullPathToRelative_Menu( absolutePath, "MOD" )
|
||||
|
||||
-- If the relative path is inside the workshop dir, it's part of a workshop addon
|
||||
if ( relativePath && relativePath:match( "^workshop[\\/].*" ) ) then
|
||||
|
||||
local addonInfo = util.RelativePathToGMA_Menu( path )
|
||||
|
||||
-- Not here? Maybe somebody just put their own file in ./workshop
|
||||
if ( addonInfo ) then
|
||||
|
||||
local addonRelativePath = util.RelativePathToFull_Menu( addonInfo.File )
|
||||
|
||||
MsgN( "'", addonInfo.Title, "' - ", addonRelativePath or addonInfo.File )
|
||||
return
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
MsgN( absolutePath )
|
||||
|
||||
end, nil, "Searches for the highest priority instance of a file within the GAME mount path." )
|
||||
Reference in New Issue
Block a user