nathanbuchar / electron-settings

📝 A simple persistent user settings framework for Electron.
https://electron-settings.js.org
MIT License
814 stars 60 forks source link

settings not setting on mac #144

Open CaiIsProgrammer opened 3 years ago

CaiIsProgrammer commented 3 years ago

I don't see any errors but doesn't seem electron settings aren't saving because when I close and reopen my application on mac the saved settings are now reset.

my getting and setting functions


       export const setUser = async (user) => {
          await settings.set("SYQELUser", user.token);
              return true;
            };
            export const getToken = async () => {

        export  const user = await settings.get("SYQELUser");
              console.log(user);
            if (user) {
              try {
                  return user;
              } catch (e) {
                  return false;
              }
            }
              return false;
            };
CaiIsProgrammer commented 3 years ago

still having this issue.

alphonse92 commented 3 years ago

same

alphonse92 commented 3 years ago

I figured out what is happening (at least in my case)

settings returns "/Users/a/Library/Application Support/Electron/settings.json" as currently settings location. However, I could found the settings.json on the same path as electron.app.getPath('userData') folder.

Could you update the library to use electron.app.getPath('userData') as default please?

alphonse92 commented 3 years ago

This is my solution

Screen Shot 2021-01-20 at 15 50 04
CaiIsProgrammer commented 3 years ago

cool! i just decided to just use local storage for now, but ill see if this fixes it for me.