Update icon paths and improve Windows yt-dlp command resolution

This commit is contained in:
2026-04-03 13:13:11 -07:00
parent 3958204737
commit 4b2861bd71
3 changed files with 53 additions and 5 deletions

View File

@@ -123,7 +123,7 @@
"productName": "SubMiner",
"executableName": "SubMiner",
"artifactName": "SubMiner-${version}.${ext}",
"icon": "assets/SubMiner.png",
"icon": "assets/SubMiner-square.png",
"directories": {
"output": "release"
},
@@ -142,7 +142,7 @@
"zip"
],
"category": "public.app-category.video",
"icon": "assets/SubMiner.png",
"icon": "assets/SubMiner-square.png",
"hardenedRuntime": true,
"entitlements": "build/entitlements.mac.plist",
"entitlementsInherit": "build/entitlements.mac.plist",

View File

@@ -68,6 +68,15 @@ export function resolveExternalYomitanExtensionPath(
return null;
}
const candidate = path.join(path.resolve(normalizedProfilePath), 'extensions', 'yomitan');
return existsSync(path.join(candidate, 'manifest.json')) ? candidate : null;
const candidate = path.join(normalizedProfilePath, 'extensions', 'yomitan');
const fallbackCandidate = path.join(path.resolve(normalizedProfilePath), 'extensions', 'yomitan');
const candidates = candidate === fallbackCandidate ? [candidate] : [candidate, fallbackCandidate];
for (const root of candidates) {
if (existsSync(path.join(root, 'manifest.json'))) {
return root;
}
}
return null;
}

View File

@@ -1,5 +1,44 @@
import fs from 'node:fs';
import path from 'node:path';
const DEFAULT_YTDLP_COMMAND = 'yt-dlp';
const WINDOWS_YTDLP_COMMANDS = ['yt-dlp.cmd', 'yt-dlp.exe', 'yt-dlp'];
function resolveFromPath(commandName: string): string | null {
if (!process.env.PATH) {
return null;
}
const searchPaths = process.env.PATH.split(path.delimiter);
for (const searchPath of searchPaths) {
const candidate = path.join(searchPath, commandName);
try {
fs.accessSync(candidate, fs.constants.X_OK);
return candidate;
} catch {
continue;
}
}
return null;
}
export function getYoutubeYtDlpCommand(): string {
return process.env.SUBMINER_YTDLP_BIN?.trim() || DEFAULT_YTDLP_COMMAND;
const explicitCommand = process.env.SUBMINER_YTDLP_BIN?.trim();
if (explicitCommand) {
return explicitCommand;
}
if (process.platform !== 'win32') {
return DEFAULT_YTDLP_COMMAND;
}
for (const commandName of WINDOWS_YTDLP_COMMANDS) {
const resolved = resolveFromPath(commandName);
if (resolved) {
return resolved;
}
}
return DEFAULT_YTDLP_COMMAND;
}