n7tae / mvoice

A prototype M17 voice application for ham radio
GNU General Public License v2.0
55 stars 13 forks source link

Aa4hs/better config #15

Closed maitbot closed 2 years ago

maitbot commented 2 years ago

The compile-time setting of CFG_DIR is crufty - since the ~ expansion is fragile. Refactoring to mvoice_cfg_dir and having main() as the one place to set it allows us to have main() process environment variables or command-line arguments to set it in the future. But, since it is now FTLK, maybe use Fl_Preferences. (FLTK < 1.4 uses ~/.fltk/... but newest FLTK will use ~/.config/... and honor $XDG_CONFIG_HOME)

Extra logic ignores the Fl_Preferences path if the mvoice48.png file is not found there. Falling back to compiled-in defaults.

n7tae commented 2 years ago

I didn't know what "crufty" meant so I had to look it up... seems a bit harsh. Can you explain your "fragile" comment? I don't understand. What's fragile about $HOME?

I never was going to let users install config stuff in /tmp. My #ifndef CFG_DIR stuff was a hold-over from when I was using inferior Linux IDEs. I will remove those since thankfully, those days are over. (So yes, that might be cruft.)

Command line arguments? MVoice is just not complex enough to warrant it.

I've been using FLTK just a little over a month now, so thanks for mentioning Fl_Preferences. I hadn't gotten around to reading about that. I think I might like to rewrite the CConfigure class using that.

n7tae commented 2 years ago

Sorry Maitland, I didn't realize that merging and then deleting the fltk branch would also close this PR. I had made an announcement on the M17 group that the fltk version was available for testing. Once I got a confirmation that it was working, I went ahead and merged main. I try to have a minimum of branches available on the server.