forked from jacobdufault/cquery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add global .cquery file (jacobdufault#702)
* Create `GetHomedirectory()` function This platform specific function is used to get the user's home directory. This gives us a base from where to get the global config file for. Currently WIP as I'm not sure how to implement this for Windows. * Find and parse .cquery in home dir if not in project dir * GetHomeDirectory() -> GetGlobalConfigDirectory() * Windows specific implementation of `GetGlobalConfigDirectory()` This is a tentative implementation, I don't have access to windows so haven't tested it but based on MSDN and StackOverflow this seems to be the way to go. * Update *nix implementation of `GetGlobalConfigDirectory()` As discussed in jacobdufault#648, fallback to $HOME if $XDG_CINFIG_HOME is not found. * Use a global .cquery file if none found in the project dir * Add rational to usage of XDG_CONFIG_HOME * Create "cquery" directory in .config if it does not exist * Fix up on Windows * Only call `CoTaskMemFree` if `ShGetKnownFolderpath` passes * Refactor config to optional to improve control flow * Add comment referencing MSDN blog on getting config dir on Windows * Implicitly call string constructor using = operator * Add braces around if-else block * Fixup some errors introduced when making config optional * config -> cfg * Fixup crash when assigning to config * Load global .cquery config at end of LoadCompilationEntriesfromdirectory Previously the global .cquery config was being loaded before the project specific compile_commands.json file. The global .cquery config is intended as a fallback when there are no other configs, so we don't want this. To make it explicit that the global .cquery is being loaded, add a new parameter to LoadFromDirectorylisting (use_global_config) which, if true, will load the global .cquery. This parameter defaults to false, so no changes are required to existing calls. * Add reference for usage of CoTaskMemFree after SHGetKnownFolderPath * Load the local .cquery in all cases that it is present
- Loading branch information
Showing
4 changed files
with
88 additions
and
14 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
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