aclap-dev / vdhcoapp

Companion application for Video DownloadHelper browser add-on
GNU General Public License v2.0
1.72k stars 280 forks source link

generate config files on build time #218

Open milahu opened 6 months ago

milahu commented 6 months ago

on build time, run this to write all config files to app/config/linux/

# enable the original install function in native-autoinstall.js
export VDHCOAPP_INSTALL_ON_BUILDTIME=1

echo generating config files for linux
export HOME=$PWD/app/config/linux
grep '^only_if_dir_exists = "~/\.' config.toml | cut -d'"' -f2 |
  while read d; do mkdir -p "$HOME/${d:2}"; done
./app/src/main.js install

on runtime, run vdhcoapp install to create symlinks from $HOME to the installed app/config/linux/

example

$ readlink /home/user/.config/chromium/NativeMessagingHosts/net.downloadhelper.coapp.json
/nix/store/0nrvqzclq34a53nyk89h7b4i3dq9mdyr-vdhcoapp-2.0.19/opt/vdhcoapp/config/linux/.config/chromium/NativeMessagingHosts/net.downloadhelper.coapp.json

im using this in vdhcoapp.nix where all paths are constant so the generated config files are always identical and when running vdhcoapp install again on runtime it is cheaper to compare symlinks instead of generating the config files and comparing file contents

where all paths are constant

this will be true only for some users so probably this will not be merged into the main branch

based on #217