hkdb / app

A cross-platform package management assistant with super powers!
https://hkdb.github.io/app/
Apache License 2.0
55 stars 2 forks source link

Settings: fix default values #9

Closed RichardFevrier closed 3 weeks ago

RichardFevrier commented 1 month ago

Using app settings the first time the app is launched a.k.a when no .config/app exists yet, returns enable true for all package managers when it should be false.

BTW a good practice when testing a value that does potentially not exists, is testing it against true like in this case (or false || nil but its less pretty).

hkdb commented 3 weeks ago

Thanks for bringing this up and offering a solution. It has been a non-critical bug that's been really "bugging" me for a while.

Actually, for this, now that I think about it, since "enable" for non-native package managers should always be false in the beginning unless that specific package manager is marked =y in the config file, I think the best and safest way to change this would be just changing the conditions from =="n" to `!=y'.

This should also fix the "first time running" issue.

Here's the commit for it:

https://github.com/hkdb/app/commit/e8c107748cf925c66e18ae099bbd6408b71b6686

RichardFevrier commented 3 weeks ago

No problem 🙂 I am curious to know how is it different from my solution @hkdb ?

hkdb commented 3 weeks ago

It's not except that I changed less amount of characters LOL.... On a second look, it's exactly the same but your way is cleaner... but oh well.... problem solved 😅️

hkdb commented 3 weeks ago

and sorry... will read more carefully next time so I don't waste your work or my time to do the same thing...