-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
core: Make cog_modules_add_directory() honor COG_MODULEDIR
Move handling of the COG_MODULEDIR environment variable into the cog_modules_add_directory() function, fix the bug that skipped using the environment variable when cog_init() is not used, and improve robustness: - The path passed is checked to be a valid directory location. - The environment variable is checked only once for the whole execution of the process, the first time the function is called with a NULL argument. - The path in the environment variable is checked for validity as well. A warning is produced for invalid locations. - If either the environment variable or the compiled-in default path are used, it is considered that the "default" path was set, and will not be set again to avoid re-scanning directories unnecessarily. While at it, sprinkle comments on the code to explain the logic.
- Loading branch information
Showing
2 changed files
with
60 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters