forked from jsnbuchanan/crowd-funder-for-time-pwa
docs: move build instructions from README to BUILDING.md
- Move detailed setup and build instructions from README.md to BUILDING.md - Add concise reference to BUILDING.md in README.md - Keep testing and other documentation in README.md - Improve organization of documentation by separating build-specific content
This commit is contained in:
@@ -1,39 +1,40 @@
|
||||
const { contextBridge, ipcRenderer } = require('electron');
|
||||
const { contextBridge, ipcRenderer } = require("electron");
|
||||
|
||||
// Use a more direct path resolution approach
|
||||
const getPath = (pathType) => {
|
||||
switch(pathType) {
|
||||
case 'userData':
|
||||
return process.env.APPDATA || (
|
||||
process.platform === 'darwin'
|
||||
switch (pathType) {
|
||||
case "userData":
|
||||
return (
|
||||
process.env.APPDATA ||
|
||||
(process.platform === "darwin"
|
||||
? `${process.env.HOME}/Library/Application Support`
|
||||
: `${process.env.HOME}/.local/share`
|
||||
: `${process.env.HOME}/.local/share`)
|
||||
);
|
||||
case 'home':
|
||||
case "home":
|
||||
return process.env.HOME;
|
||||
case 'appPath':
|
||||
case "appPath":
|
||||
return process.resourcesPath;
|
||||
default:
|
||||
return '';
|
||||
return "";
|
||||
}
|
||||
};
|
||||
|
||||
console.log('Preload script starting...');
|
||||
console.log("Preload script starting...");
|
||||
|
||||
try {
|
||||
contextBridge.exposeInMainWorld('electronAPI', {
|
||||
contextBridge.exposeInMainWorld("electronAPI", {
|
||||
// Path utilities
|
||||
getPath,
|
||||
|
||||
|
||||
// IPC functions
|
||||
send: (channel, data) => {
|
||||
const validChannels = ['toMain'];
|
||||
const validChannels = ["toMain"];
|
||||
if (validChannels.includes(channel)) {
|
||||
ipcRenderer.send(channel, data);
|
||||
}
|
||||
},
|
||||
receive: (channel, func) => {
|
||||
const validChannels = ['fromMain'];
|
||||
const validChannels = ["fromMain"];
|
||||
if (validChannels.includes(channel)) {
|
||||
ipcRenderer.on(channel, (event, ...args) => func(...args));
|
||||
}
|
||||
@@ -41,15 +42,15 @@ try {
|
||||
// Environment info
|
||||
env: {
|
||||
isElectron: true,
|
||||
isDev: process.env.NODE_ENV === 'development'
|
||||
isDev: process.env.NODE_ENV === "development",
|
||||
},
|
||||
// Path utilities
|
||||
getBasePath: () => {
|
||||
return process.env.NODE_ENV === 'development' ? '/' : './';
|
||||
}
|
||||
return process.env.NODE_ENV === "development" ? "/" : "./";
|
||||
},
|
||||
});
|
||||
|
||||
console.log('Preload script completed successfully');
|
||||
console.log("Preload script completed successfully");
|
||||
} catch (error) {
|
||||
console.error('Error in preload script:', error);
|
||||
}
|
||||
console.error("Error in preload script:", error);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user