1
실행할 때 내 컴퓨터에 저장된 실행 파일을 시작하는 전자 애플리케이션을 만들고 있습니다. exe를 단독으로 실행하면 제대로 작동하고 모든 글꼴이로드됩니다. 그러나 전자 응용 프로그램으로 실행하면 열리지 만 글꼴 파일은로드 할 수 없습니다. exe는 Visual Studio에서 제작 된 컴파일 프로젝트입니다.전자 프로젝트의 실행 파일이 리소스를로드하지 않습니다.
res 폴더를 index.html과 동일한 디렉토리에 넣지 않으려 고 시도했습니다. index.html을위한
코드 : main.js
const {app, BrowserWindow} = require('electron')
const path = require('path')
const url = require('url')
function createWindow() {
// Create the browser window.
win = new BrowserWindow({width: 800, height: 600})
// and load the index.html of the app.
win.loadURL(url.format({
pathname: path.join(__dirname, 'index.html'),
protocol: 'file:',
slashes: true
}))
win.webContents.openDevTools()
// Emitted when the window is closed.
win.on('closed',() => {
win = null
})
}
app.on('ready', createWindow)
// Quit when all windows are closed.
app.on('window-all-closed',() => {
if (process.platform !== 'darwin') {
app.quit()
}
})
app.on('activate',() => {
if (win === null) {
createWindow()
}
})
감사에 대한
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Hello World!</title>
</head>
<body>
<h1>Hello World!</h1>
<script>
var child = require('child_process').execFile;
var exePath = "C:\\Users\\name\\Documents\\Visual Studio 2015\\Projects\\Ten\\Release\\Ten.exe";
var parameters = ["test"];
child(exePath, parameters, function(err, data){
console.log(err);
console.log(data.toString());
})
</script>
</body>
</html>
코드!
감사합니다. – guavadrag0n