__has_include matches files in unpacked mods even if the mod is not loaded.
- Operating System
- Windows 10 x64
- Unpack a mod and place it in the Arma 3 root directory.
- Create a dummy mod that checks for a file inside the unpacked mod with __has_include.
- Start game with file patching enabled, but only load the dummy mod.
- Notice that __has_include was true for the dummy mod.
That fix actually is the root of this issue. Yes, __has_include matches unpacked mods now when file patching is enabled. Problem is that it does so regardless whether the mod is actually loaded or not.
I'm sorry for the confusion I created. We were trying to get rid of ACE optionals for ZEN by using __has_include, but still have issues with file patching.
At this point it's more likely an issue on our end, since I take your word that it was fixed. Hence, consider it as resolved.
I finally understood your issue.
Repro (this would've been useful to understand the issue)
Place testo.hpp in your Arma folder.
Use this in config
#if __has_include("\testo.hpp") blabla blub bla bla #endif
Even though there is no testo.hpp in any mod, the has include still returns true. Because it finds the file in Arma folder.
But here comes the kicker,
#include "\testo.hpp" DOES include the file, even if its not in a mod and only in Arma folder through filePatching. This in fact is a thing mods depend on for UserConfigs, or.. used to.
So this is not a new thing, and also not a unexpected behaviour. has_include checks if a file exists, for the purposes of including it.
So the final answer is, everything works as designed. We might want a separate has_file that has different constraints, but I don't want to do that.