-
-
Notifications
You must be signed in to change notification settings - Fork 736
Description
I am developing an Electron.NET application using .NET Core 6 and I want to prevent my SQLite database file from being overwritten during the installation process if it already exists. I have added the necessary code to my manually created 'main.js' file to check for the existence of the file and copy it only if it doesn't exist. However, when I build the package using 'electronize build /target win', the code in my 'main.js' file is not reflected in the built package. Is this a bug or am I missing something?
`const fs = require('fs');
const path = require('path');
const { app } = require('electron');
// Get the installation directory
const appPath = app.getPath('exe');
const installDir = path.dirname(appPath);
// Check if the database file already exists
const dbFile = path.join(installDir, 'mydb.sqlite');
if (!fs.existsSync(dbFile)) {
const resourcePath = path.join(__dirname, 'mydb.sqlite');
fs.copyFileSync(resourcePath, dbFile);
}`