Skip to content

Commit

Permalink
Copy via afterpack
Browse files Browse the repository at this point in the history
  • Loading branch information
KenCorma committed Oct 26, 2024
1 parent 173da0f commit 563d683
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
24 changes: 23 additions & 1 deletion scripts/todesktop/afterPack.js
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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});
}
}
2 changes: 1 addition & 1 deletion todesktop.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
}

0 comments on commit 563d683

Please sign in to comment.