Skip to content

Commit 40f2e6b

Browse files
authored
chore: remove dead code (#80)
1 parent dfeb7dc commit 40f2e6b

File tree

2 files changed

+0
-142
lines changed

2 files changed

+0
-142
lines changed

src/macadam.ts

Lines changed: 0 additions & 93 deletions
This file was deleted.

src/utils.ts

Lines changed: 0 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -16,55 +16,6 @@
1616
* SPDX-License-Identifier: Apache-2.0
1717
***********************************************************************/
1818

19-
import { existsSync } from 'node:fs';
20-
import { homedir } from 'node:os';
21-
import { join, resolve } from 'node:path';
22-
23-
const localBinDir = '/usr/local/bin';
24-
25-
/**
26-
* Calculate the system path of the binary
27-
* @returns
28-
*/
29-
export function getSystemBinaryPath(binaryName: string): string {
30-
switch (process.platform) {
31-
case 'win32':
32-
return join(
33-
homedir(),
34-
'AppData',
35-
'Local',
36-
'Microsoft',
37-
'WindowsApps',
38-
binaryName.endsWith('.exe') ? binaryName : `${binaryName}.exe`,
39-
);
40-
case 'darwin':
41-
case 'linux':
42-
return join(localBinDir, binaryName);
43-
default:
44-
throw new Error(`unsupported platform: ${process.platform}.`);
45-
}
46-
}
47-
48-
/**
49-
* Given an executable name, it will find where it is installed on the system.
50-
* It first try to search it in the system-wide folder, then in the extension storage
51-
* @param executable
52-
*/
53-
export async function whereBinary(storagePath: string, binaryName: string): Promise<string> {
54-
const macadamSystemWidePath = getSystemBinaryPath(binaryName);
55-
if (existsSync(macadamSystemWidePath)) {
56-
return macadamSystemWidePath;
57-
}
58-
59-
const macadamStoragePath = resolve(storagePath, 'bin', binaryName);
60-
if (existsSync(macadamStoragePath)) {
61-
return macadamStoragePath;
62-
}
63-
64-
// if it's not installed either in the extension storage path or system wide throw an error
65-
throw new Error('no macadam binary found');
66-
}
67-
6819
export function getErrorMessage(err: unknown): string {
6920
if (err && typeof err === 'object' && 'message' in err) {
7021
return String(err.message);

0 commit comments

Comments
 (0)