access assets after installed mac
supun19 opened this issue · comments
supun madushanka commented
Summary
I have assets, and when I package them, I add them to the extraResources as well. However, when I try to get the path of the assets folder using process.resourcesPath, it gives me the wrong path. It provides the project folder path instead of the installed application path
"/Users/usename/electron-react-boilerplate/release/build/mac/TestApp.app/Contents/Resources"
This is working well development environment
const { sourcefile, filename } = data;
const videoPath = app.getPath('exe');
const pathSep = path.sep;
let source;
if (process.env.NODE_ENV === 'development') {
source = path.join('assets', 'videos', sourcefile);
} else {
source = path.join(
process.resourcesPath,
'app.asar',
'assets',
'videos',
sourcefile,
);
}
const pth = path.join(app.getPath('userData'), filename);
console.log(source, pth);
const res = fs.copyFileSync(source, pth);
return { result: res };
supun madushanka commented
anyone have idea