Skip to content

Refine HsMod.cfg auto-detection for one-click exe usage - #1

Open
sstxww wants to merge 1 commit into
mainfrom
codex/review-task-usage-instructions
Open

sstxww wants to merge 1 commit into
mainfrom
codex/review-task-usage-instructions

Conversation

@sstxww

@sstxww sstxww commented Jan 7, 2026

Copy link
Copy Markdown
Owner

Motivation

  • Remove the hardcoded config path so the executable can locate HsMod.cfg automatically.
  • Allow an explicit override from the command line while preferring the executable directory and current working directory.
  • Avoid broad recursive scanning by using a bounded parent traversal to limit search cost.
  • Provide a clear early-exit message when HsMod.cfg cannot be found.

Description

  • Replace the hardcoded configFilePath with a call to ResolveConfigPath(args) and early-return when it is null or empty.
  • Add ResolveConfigPath, EnumerateCandidatePaths, and FindConfigFileInParents to search in AppContext.BaseDirectory, Directory.GetCurrentDirectory(), and parent directories up to 4 levels.
  • Check both HsMod.cfg and BepInEx/config/HsMod.cfg candidates during lookup and prefer the executable directory first via AppContext.BaseDirectory.
  • Add using System.Collections.Generic; and simplify the search logic by removing the previous broad recursive enumeration.

Testing

  • No automated tests were executed for this change.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant