Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate appdata to platform-specific locations #498

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

probablykasper
Copy link

Would love to have this implemented, though if you insist on not changing, then I suppose it is what it is.

Currently I'm just running a migration in electron.js, moving ~/.dbgate to <userData>/dbgate and <userData>/* to <userData>/electron/* (except config-root.json)

I'm guessing that ideally the migration would run from packages/api/src/utility/directories.js, but it needs to run in electron.js before createWindow(). Could api be imported before createWindow(), or does it have to be deferred?

I wasn't able to test it because because yarn install fails:

➤ YN0009: │ dbgate-all@workspace:. couldn't be built successfully (exit code 1, logs can be found here: /private/var/folders/gs/3qcm1mc918s08sxvkj6zj2rr0000gp/T/xfs-a886ecd0/build.log)
➤ YN0000: └ Completed in 15s 418ms
➤ YN0000: Failed with errors in 16s 210ms

Closes #459

@ProjectInfinity
Copy link
Collaborator

This doesn't work due to errors.
ReferenceError: Cannot access 'electrondir' before initialization
at migrateDataDir (/home/alex/Downloads/dbgate/app/src/electron.js:46:57)

Also, can you confirm which paths will be used on all operating systems?
macOS,
Linux,
Windows.

You will likely need cases for each of these if you truly want to adhere to how each operating system tends to work.

@janproch
Copy link
Member

Sorry but this could't work

datadir must be exported from directories.js, there is still old definition.
I have already implemented one data directory migration, it is implemented here:

function migrateDataDir() {

This was solved with issue #248

If I remember correctly createWindow is called before importing API because of better UX - so that user could see message about loading DbGate as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: App data in non-standard location
3 participants