Update: 规范化项目结构
This commit is contained in:
2
LICENSE
2
LICENSE
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Kisechan
|
||||
Copyright (c) 2025 Kisechan <admin@kisechan.space>
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
Before Width: | Height: | Size: 4.2 KiB After Width: | Height: | Size: 4.2 KiB |
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
12
main/main.js
12
main/main.js
@ -24,14 +24,14 @@ ipcMain.on("play-sound", (_, soundFile) => {
|
||||
// 在开发模式下,直接指向 renderer/public 里的文件
|
||||
soundPath = path.join(
|
||||
__dirname,
|
||||
"../renderer/public/assets/sounds",
|
||||
"../renderer/public/sounds",
|
||||
soundFile
|
||||
);
|
||||
} else {
|
||||
// 在生产模式下,Vite 会把 public 里的文件复制到 dist 文件夹
|
||||
soundPath = path.join(
|
||||
__dirname,
|
||||
"../renderer/dist/assets/sounds",
|
||||
"../renderer/dist/sounds",
|
||||
soundFile
|
||||
);
|
||||
}
|
||||
@ -51,13 +51,13 @@ ipcMain.handle("get-sound-path", (_, soundFile) => {
|
||||
if (process.env.NODE_ENV === "development") {
|
||||
soundPath = path.join(
|
||||
__dirname,
|
||||
"../renderer/public/assets/sounds",
|
||||
"../renderer/public/sounds",
|
||||
soundFile
|
||||
);
|
||||
} else {
|
||||
soundPath = path.join(
|
||||
__dirname,
|
||||
"../renderer/dist/assets/sounds",
|
||||
"../renderer/dist/sounds",
|
||||
soundFile
|
||||
);
|
||||
}
|
||||
@ -74,8 +74,8 @@ ipcMain.handle("get-sound-path", (_, soundFile) => {
|
||||
ipcMain.handle("get-sound-files", async () => {
|
||||
const soundDir =
|
||||
process.env.NODE_ENV === "development"
|
||||
? path.join(__dirname, "../renderer/public/assets/sounds")
|
||||
: path.join(__dirname, "../renderer/dist/assets/sounds");
|
||||
? path.join(__dirname, "../renderer/public/sounds")
|
||||
: path.join(__dirname, "../renderer/dist/sounds");
|
||||
|
||||
try {
|
||||
// 读取目录下的所有文件名
|
||||
|
Before Width: | Height: | Size: 90 KiB After Width: | Height: | Size: 90 KiB |
Reference in New Issue
Block a user