diff --git a/scripts/todesktop/afterPack.js b/scripts/todesktop/afterPack.js index 0bfa54a5..559a46a2 100644 --- a/scripts/todesktop/afterPack.js +++ b/scripts/todesktop/afterPack.js @@ -1,5 +1,8 @@ +const os = require('os'); +const fs = require('fs/promises'); +const path = require('path'); -module.exports = async ({ appOutDir, packager }) => { +module.exports = async ({ appOutDir, packager,outDir }) => { /** * appPkgName - string - the name of the app package * appId - string - the app id @@ -9,4 +12,23 @@ module.exports = async ({ appOutDir, packager }) => { * packager - object - the packager object * arch - number - the architecture of the app. ia32 = 0, x64 = 1, armv7l = 2, arm64 = 3, universal = 4. */ + + if (os.platform() === "darwin") { + const appName = packager.appInfo.productFilename; + const appPath = path.join(`${appOutDir}`, `${appName}.app`); + const mainPath = path.dirname(outDir); + const assetPath = path.join(mainPath,'assets'); + const resourcePath = path.join(appPath,"Contents","Resourses"); + await fs.cp(assetPath, resourcePath, {recursive: true}); + } + + if (os.platform() === 'win32') + { + const appName = packager.appInfo.productFilename; + const appPath = path.join(`${appOutDir}`, `${appName}.exe`); + const mainPath = path.dirname(outDir); + const assetPath = path.join(mainPath,'assets'); + const resourcePath = path.join(path.dirname(appPath),"resourses"); + await fs.cp(assetPath, resourcePath, {recursive: true}); + } } \ No newline at end of file diff --git a/todesktop.json b/todesktop.json index f587719d..352a9ff4 100644 --- a/todesktop.json +++ b/todesktop.json @@ -5,6 +5,6 @@ "uploadSizeLimit": 250, "appPath": ".", "appFiles": ["src/**", "scripts/**", "assets/**", "dist/**", ".vite/**", ".yarnrc.yml", ".yarn/**"], - "extraResources": [{ "from": "./assets/python.tgz" }, { "from": "./assets" }], + "extraResources": [{ "from": "./assets" }], "filesForDistribution": ["!.yarn/**", "!.yarnrc.yml"] }