Skip to content

Commit 61bffa4

Browse files
authored
fix(bundler): match on Path::extension instead of using Path::ends_with (#11327)
1 parent 2d087ee commit 61bffa4

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

crates/tauri-bundler/src/bundle/windows/msi/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ use regex::Regex;
2121
use serde::{Deserialize, Serialize};
2222
use std::{
2323
collections::{BTreeMap, HashMap, HashSet},
24+
ffi::OsStr,
2425
fs::{self, File},
2526
io::Write,
2627
path::{Path, PathBuf},
@@ -611,7 +612,7 @@ pub fn build_wix_app_installer(
611612
settings
612613
.icon_files()
613614
.flatten()
614-
.find(|i| i.ends_with(".ico"))
615+
.find(|i| i.extension() == Some(OsStr::new("ico")))
615616
.context("Couldn't find a .ico icon")?
616617
};
617618
let icon_path = copy_icon(settings, "icon.ico", &icon_path)?;

packages/cli/__tests__/template.spec.ts

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,24 @@
33
// SPDX-License-Identifier: MIT
44

55
import { resolve } from 'node:path'
6+
import { spawnSync } from 'node:child_process'
67
import {
78
existsSync,
89
readFileSync,
910
writeFileSync,
1011
rmSync,
1112
renameSync
1213
} from 'node:fs'
13-
import cli from '../main.js'
14-
import { describe, it } from 'vitest'
14+
import { beforeAll, describe, it } from 'vitest'
15+
16+
// Build CLI before tests, for local usage only.
17+
// CI builds the CLI on different platforms and architectures
18+
if (!process.env.CI) {
19+
beforeAll(() => {
20+
const cliDir = resolve(__dirname, '..')
21+
exec('pnpm', ['build:debug'], { cwd: cliDir })
22+
})
23+
}
1524

1625
describe('[CLI] @tauri-apps/cli template', () => {
1726
it('init a project and builds it', { timeout: 15 * 60 * 1000 }, async () => {
@@ -31,6 +40,8 @@ describe('[CLI] @tauri-apps/cli template', () => {
3140
renameSync(outPath, cacheOutPath)
3241
}
3342

43+
const cli = await import('../main.js')
44+
3445
await cli.run([
3546
'init',
3647
'--directory',
@@ -63,3 +74,15 @@ describe('[CLI] @tauri-apps/cli template', () => {
6374
process.chdir(cwd)
6475
})
6576
})
77+
78+
function exec(
79+
bin: string,
80+
args?: string[],
81+
opts?: {
82+
cwd?: string
83+
}
84+
) {
85+
process.platform === 'win32'
86+
? spawnSync('cmd', ['/c', bin, ...(args ?? [])], { cwd: opts?.cwd })
87+
: spawnSync(bin, args, { cwd: opts?.cwd })
88+
}

0 commit comments

Comments
 (0)