1
0
mirror of https://github.com/alliedmodders/metamod-source.git synced 2024-11-28 10:24:20 +01:00

fix: Improve path handling and relpath support in s2 sample plugin

This commit is contained in:
Nick Hastings 2024-07-06 13:18:31 -04:00
parent cc8c76cca1
commit d693e30816

View File

@ -59,11 +59,16 @@ def ResolveMMSRoot():
mms_root = ResolveMMSRoot()
if not builder.options.hl2sdk_manifests:
raise Exception('Could not find a source copy of HL2SDK manifests')
hl2sdk_manifests = builder.options.hl2sdk_manifests
def ResolveHL2SDKManifestsRoot():
prenormalized_path = builder.options.hl2sdk_manifests
if not prenormalized_path or not os.path.isdir(prenormalized_path):
raise Exception('Could not find a source copy of HL2SDK manifests')
return os.path.abspath(os.path.normpath(prenormalized_path))
SdkHelpers = builder.Eval(os.path.join(hl2sdk_manifests, 'SdkHelpers.ambuild'), {
hl2sdk_manifests_root = ResolveHL2SDKManifestsRoot()
SdkHelpers = builder.Eval(os.path.join(hl2sdk_manifests_root, 'SdkHelpers.ambuild'), {
'Project': 'metamod'
})
@ -110,7 +115,7 @@ class MMSPluginConfig(object):
def findSdkPath(self, sdk_name):
dir_name = 'hl2sdk-{}'.format(sdk_name)
if builder.options.hl2sdk_root:
sdk_path = os.path.join(builder.options.hl2sdk_root, dir_name)
sdk_path = os.path.abspath(os.path.normpath(os.path.join(builder.options.hl2sdk_root, dir_name)))
if os.path.exists(sdk_path):
return sdk_path
return ResolveEnvPath('HL2SDK{}'.format(sdk_name.upper()), dir_name)