Electron prepending the application path to my src path in production


#1

I have a bunch of images that are downloaded from a server and saved in the applications userData path. In development I can reference these fine in an image element. However once in production, the path is being prepended with the applications path.

So I buuld the path like so:

return path.join(app.getPath('appData'), 'MyApp', asset.url);

I was originally using:

return path.join(app.getPath('userData'), asset.url);

This returns: C:\Users\Dev\AppData\Roaming\MyApp\assets\5280.jpeg which is correct.

When in production, the src says C:\Users\Dev\AppData\Roaming\MyApp\assets\5280.jpeg but the tooltip says file:///C:/Users/Dev/AppData/MyApp/app-0.1.1/resources/app/src/C:\Users\Dev\AppData\Roaming\MyApp\assets\5280.jpeg , so it’s prepending file:///C:/Users/Dev/AppData/MyApp/app-0.1.1/resources/app/src/.

Somewhat at a loss here on how resolve this. Any ideas?