🐞 fix: 优化远程控制页面HTML路径获取逻辑,支持开发环境与生产环境的路径区分

This commit is contained in:
algerkong
2025-05-02 22:53:19 +08:00
parent c2e08db2e4
commit 5f63ab6b4a

View File

@@ -213,7 +213,9 @@ function setupRoutes(app: express.Application) {
app.get('/', (_, res) => {
try {
const resourcesPath = process.resourcesPath || '';
const finalPath = path.join(resourcesPath, 'html', 'remote-control.html');
const isDev = process.env.NODE_ENV === 'development';
const htmlPath = path.join(process.cwd(), 'resources', 'html', 'remote-control.html');
const finalPath = isDev ? htmlPath : path.join(resourcesPath, 'html', 'remote-control.html');
if (fs.existsSync(finalPath)) {
res.sendFile(finalPath);