electron-settings icon indicating copy to clipboard operation
electron-settings copied to clipboard

settings not setting on mac

Open CaiIsProgrammer opened this issue 4 years ago • 5 comments

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 avatar Jan 09 '21 01:01 CaiIsProgrammer

still having this issue.

CaiIsProgrammer avatar Jan 14 '21 16:01 CaiIsProgrammer

same

alphonse92 avatar Jan 20 '21 20:01 alphonse92

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 avatar Jan 20 '21 20:01 alphonse92

This is my solution

Screen Shot 2021-01-20 at 15 50 04

alphonse92 avatar Jan 20 '21 20:01 alphonse92

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

CaiIsProgrammer avatar Feb 01 '21 19:02 CaiIsProgrammer