ersh1 / BG3_NativeCameraTweaks

GNU General Public License v3.0
51 stars 10 forks source link

Symlinked config monitoring #25

Open konr4d opened 3 weeks ago

konr4d commented 3 weeks ago

If the mod is deployed using symlinks (Vortex) then the watcher can't discern and reload the changed config file.

It's a Nice-To-Have really:

  1. The WatchForChanges could check if the config file is a symbolic link with something like GetFileAttributes looking for FILE_ATTRIBUTE_REPARSE_POINT,
  2. Resolve the target path of a symlink by CreateFile with FILE_FLAG_OPEN_REPARSE_POINT and DeviceIoControl (to read the reparse data buffer),
  3. Set up directory monitoring of the symlink's target directory.

Also btw., perhaps the config itself could be moved to a subdirectory since ReadDirectoryChangesW is a bit intensive and locking, and could interfere with other mods and game if they're logging much, potentially (I don't know NativeModLoader implementation, if it's async, etc.).

These are just some thoughts after few minutes of looking at the code after wishing NCT had a way to change it's settings live, like a BG3SE console command or MCM and noticing that it indeed has it - just not for my Vortex setup :-) Also, I am not a C++ dev and that's why I don't post a PR. These are just some ideas I came up with looking at win32 api docs.