Skip to content

Fix config loader paths for dynamic loading - #99

Closed
sarahsturgeon with Copilot wants to merge 3 commits into
chore/move-configs-to-own-filefrom
copilot/sub-pr-98
Closed

Fix config loader paths for dynamic loading#99
sarahsturgeon with Copilot wants to merge 3 commits into
chore/move-configs-to-own-filefrom
copilot/sub-pr-98

Conversation

Copilot AI commented Dec 8, 2025

Copy link
Copy Markdown

The config loader was using incorrect paths that would fail at runtime. The include() function requires paths relative to lua/ directory, but the loader was constructing incomplete paths.

Changes

  • Fixed loader path construction: Updated sv_config.lua to use cfc_random_spawn/configs/ prefix instead of configs/
  • Fixed variant config includes: Updated 5 files (night/day variants) to use full paths when including base configs:
    • gm_boreas_night.lua, gm_novenka_night.lua, gm_tornadoalley_day.lua
    • rp_nycity.lua, rp_southside_day.lua
  • Added path traversal protection: Validate map name before constructing file path

Before/After

-- Before (broken)
local configPath = "configs/" .. game.GetMap() .. ".lua"
include( configPath )  -- Won't resolve correctly

-- After (working)
local mapName = game.GetMap()
if not mapName or mapName == "" or string.find( mapName, "[/\\]" ) then
    return
end
local configPath = "cfc_random_spawn/configs/" .. mapName .. ".lua"
include( configPath )  -- Resolves from lua/ directory

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 2 commits December 8, 2025 03:07
Co-authored-by: sarahsturgeon <7936439+sarahsturgeon@users.noreply.github.com>
Co-authored-by: sarahsturgeon <7936439+sarahsturgeon@users.noreply.github.com>
Copilot AI changed the title [WIP] Chore: Move configs to their own files and load dynamically Fix config loader paths for dynamic loading Dec 8, 2025
Copilot AI requested a review from sarahsturgeon December 8, 2025 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants