Skip to content

Commit f51d59f

Browse files
More refactor
1 parent a3aa7fd commit f51d59f

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

lib/extensions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ const extractArchive = (filePath, outputDir, extension) => {
177177
* Score asset based on extension and platform compatibility
178178
*/
179179
const scoreAssetByExtension = (asset, platform, capabilities) => {
180-
if (!asset.extension) return 0;
180+
if (!asset.extension) return 5; // Give points to direct binaries to prioritize over archives
181181

182182
let score = 0;
183183
const { extension } = asset;

lib/installers.js

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const getPlatformInfo = () => {
6464

6565
// Use getInstallCapabilities from extensions module
6666

67-
const selectBestAsset = (assets, platformInfo, capabilities) => {
67+
const selectBestAsset = (assets, platformInfo, capabilities, firstFlag = false) => {
6868
const { myArch, myPlatform } = platformInfo;
6969
const { platform } = platformInfo;
7070

@@ -101,9 +101,14 @@ const selectBestAsset = (assets, platformInfo, capabilities) => {
101101
if (incl(compatiblePlatforms, myPlatform)) {
102102
asset.points += 3; // Increased from 1 to 3
103103

104-
// Bonus for platform-specific assets without extensions (like "yt-dlp_macos")
104+
// Significant bonus for platform-specific assets without extensions when using --first
105+
// This prioritizes direct binaries like "yt-dlp_macos" over archives like .zip
105106
if (!asset.extension) {
106-
asset.points += 2;
107+
if (firstFlag) {
108+
asset.points += 10; // Much higher bonus when --first flag is used
109+
} else {
110+
asset.points += 8; // Increased bonus to prioritize binaries over archives
111+
}
107112
}
108113
} else {
109114
asset.delete = true;

0 commit comments

Comments
 (0)