Okay, that is what I did, so no ifdefs at all!
It uses one text file called "env-vars.txt" inside the root of the Sigil Preferences folder.
I modified it to use Utility::ReadUnicodeTextFile() so it should be able to automatically handle native Windows utf-16 text files as well as normal utf-8 text files, and should handle removing any BOM markers so nothing should interfere.
The format is (one per line):
ENVIRONMENT_VARIABLE_NAME=VALUE
both are treated as strings that are trimmed so no quotes are needed anyplace.
I tried to make this happen as early as possible after main() so that even Qt and Chrome EVs can be set into the env-vars.txt file properly. Note, that means this file is only read once on first startup of Sigil.
I have just pushed this to master. I will update the sigil-user-guide to reflect how this env-vars.txt can be used to make setting environment variables easier for everyone in the advanced topics chapter that lists all of our environment variables.
If anyone builds their own and uses Sigil or Qt/Chrome env vars, please give it a try and let me know if any issues happen.
Thanks
Update: I pushed the Sigil User Guide updates to its master. It will be ready when we do our next release (ie. 2.6.2) sometime down the road.
Last edited by KevinH; 08-19-2025 at 12:29 PM.
|