replit / desktop

Replit Desktop App
114 stars 3 forks source link

Fix electron-store creating dirs in dev #120

Closed sergeichestakov closed 1 year ago

sergeichestakov commented 1 year ago

Why

Tried to run the app on Windows and saw this error:

Screenshot 2023-08-29 at 1 13 37 PM

This seems like a bug in electron-store but this led me to realize that electron-store is creating directories under the hood if the name field passed to an electron store instance contains a / which it does in development since we use the Base URL (e.g. http://locahost:3000, https://staging.replit.com) to seed the name to create different stores for the different modes of development. This was easy to confirm by looking in the Application Support directory on Mac which is where the logs get written to:

Screenshot 2023-08-29 at 1 49 08 PM

Instead, we should be a bit smarter about it and create explicit filenames for each (local, staging, prod, etc) that do not include a /.

What changed

Fix electron-store creating dirs in dev

Test plan

Should not be creating new dirs for the store and instead writing to config-dev-local, config-dev-staging, etc. Prod should remain the same.