Skip to content

Commit d44ad8d

Browse files
committed
fix path inside zip
1 parent 0418ffd commit d44ad8d

File tree

3 files changed

+27
-15
lines changed

3 files changed

+27
-15
lines changed

dist/index.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28409,9 +28409,13 @@ function getPlatform() {
2840928409
}
2841028410
}
2841128411

28412+
function getZipName(osPlatform) {
28413+
return `BinDiff-${osPlatform}`;
28414+
}
28415+
2841228416
function getUrl(version, osPlatform) {
2841328417
const versionPart = version === 'latest' ? 'latest/download' : `download/${version}`;
28414-
return `${BASE_URL}/releases/${versionPart}/BinDiff-${osPlatform}.zip`;
28418+
return `${BASE_URL}/releases/${versionPart}/${getZipName(osPlatform)}.zip`;
2841528419
}
2841628420

2841728421
function exeName(name) {
@@ -28495,6 +28499,8 @@ async function download() {
2849528499
const extractPath = await tc.extractZip(downloadPath);
2849628500
core.debug(`extractPath: ${extractPath}`);
2849728501

28502+
const bindiffPath = path.join(extractPath, getZipName(osPlatform));
28503+
2849828504
if (!process.env.RUNNER_TEMP)
2849928505
throw new Error('Environment variable RUNNER_TEMP is not set');
2850028506

@@ -28504,18 +28510,18 @@ async function download() {
2850428510
core.info(`Installing to ${outputPath}`);
2850528511
const binDir = path.join(outputPath, 'bin');
2850628512
await io.mkdirP(binDir);
28507-
await io.mv(path.join(extractPath, exeName('bindiff')), binDir);
28508-
await io.mv(path.join(extractPath, 'tools', exeName('bindiff_config_setup')), binDir);
28509-
await io.mv(path.join(extractPath, 'tools', exeName('binexport2dump')), binDir);
28513+
await io.mv(path.join(bindiffPath, exeName('bindiff')), binDir);
28514+
await io.mv(path.join(bindiffPath, 'tools', exeName('bindiff_config_setup')), binDir);
28515+
await io.mv(path.join(bindiffPath, 'tools', exeName('binexport2dump')), binDir);
2851028516

2851128517
const idaPluginDir = getPluginsDir(outputPath, 'IDA Pro');
2851228518
await io.mkdirP(idaPluginDir);
28513-
await io.mv(path.join(extractPath, 'ida', dllName('binexport12_ida')), idaPluginDir);
28514-
await io.mv(path.join(extractPath, 'ida', dllName('bindiff8_ida')), idaPluginDir);
28519+
await io.mv(path.join(bindiffPath, 'ida', dllName('binexport12_ida')), idaPluginDir);
28520+
await io.mv(path.join(bindiffPath, 'ida', dllName('bindiff8_ida')), idaPluginDir);
2851528521

2851628522
const binjaPluginDir = getPluginsDir(outputPath, 'Binary Ninja');
2851728523
await io.mkdirP(binjaPluginDir);
28518-
await io.mv(path.join(extractPath, 'binaryninja', dllName('binexport12_binaryninja')), binjaPluginDir);
28524+
await io.mv(path.join(bindiffPath, 'binaryninja', dllName('binexport12_binaryninja')), binjaPluginDir);
2851928525

2852028526
// mark as executable on linux
2852128527
if (osPlatform === 'linux') {

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/main.js

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ function getPlatform() {
2020
}
2121
}
2222

23+
function getZipName(osPlatform) {
24+
return `BinDiff-${osPlatform}`;
25+
}
26+
2327
function getUrl(version, osPlatform) {
2428
const versionPart = version === 'latest' ? 'latest/download' : `download/${version}`;
25-
return `${BASE_URL}/releases/${versionPart}/BinDiff-${osPlatform}.zip`;
29+
return `${BASE_URL}/releases/${versionPart}/${getZipName(osPlatform)}.zip`;
2630
}
2731

2832
function exeName(name) {
@@ -106,6 +110,8 @@ async function download() {
106110
const extractPath = await tc.extractZip(downloadPath);
107111
core.debug(`extractPath: ${extractPath}`);
108112

113+
const bindiffPath = path.join(extractPath, getZipName(osPlatform));
114+
109115
if (!process.env.RUNNER_TEMP)
110116
throw new Error('Environment variable RUNNER_TEMP is not set');
111117

@@ -115,18 +121,18 @@ async function download() {
115121
core.info(`Installing to ${outputPath}`);
116122
const binDir = path.join(outputPath, 'bin');
117123
await io.mkdirP(binDir);
118-
await io.mv(path.join(extractPath, exeName('bindiff')), binDir);
119-
await io.mv(path.join(extractPath, 'tools', exeName('bindiff_config_setup')), binDir);
120-
await io.mv(path.join(extractPath, 'tools', exeName('binexport2dump')), binDir);
124+
await io.mv(path.join(bindiffPath, exeName('bindiff')), binDir);
125+
await io.mv(path.join(bindiffPath, 'tools', exeName('bindiff_config_setup')), binDir);
126+
await io.mv(path.join(bindiffPath, 'tools', exeName('binexport2dump')), binDir);
121127

122128
const idaPluginDir = getPluginsDir(outputPath, 'IDA Pro');
123129
await io.mkdirP(idaPluginDir);
124-
await io.mv(path.join(extractPath, 'ida', dllName('binexport12_ida')), idaPluginDir);
125-
await io.mv(path.join(extractPath, 'ida', dllName('bindiff8_ida')), idaPluginDir);
130+
await io.mv(path.join(bindiffPath, 'ida', dllName('binexport12_ida')), idaPluginDir);
131+
await io.mv(path.join(bindiffPath, 'ida', dllName('bindiff8_ida')), idaPluginDir);
126132

127133
const binjaPluginDir = getPluginsDir(outputPath, 'Binary Ninja');
128134
await io.mkdirP(binjaPluginDir);
129-
await io.mv(path.join(extractPath, 'binaryninja', dllName('binexport12_binaryninja')), binjaPluginDir);
135+
await io.mv(path.join(bindiffPath, 'binaryninja', dllName('binexport12_binaryninja')), binjaPluginDir);
130136

131137
// mark as executable on linux
132138
if (osPlatform === 'linux') {

0 commit comments

Comments
 (0)