更新rust代码中的名称为conf中变量
This commit is contained in:
2
bin/builders/common.ts
vendored
2
bin/builders/common.ts
vendored
@@ -42,7 +42,7 @@ export async function mergeTauriConfig(
|
||||
tauriConf.tauri.bundle.identifier = identifier;
|
||||
tauriConf.tauri.bundle.icon = [options.icon];
|
||||
if (process.platform === "win32") {
|
||||
const ico_path = path.join(npmDirectory, 'src-tauri/png/weread_32.ico');
|
||||
const ico_path = path.join(npmDirectory, `src-tauri/png/${name.toLowerCase()}_32.ico`);
|
||||
await fs.copyFile(options.icon, ico_path);
|
||||
}
|
||||
if (process.platform === "linux") {
|
||||
|
||||
3916
dist/cli.js
vendored
3916
dist/cli.js
vendored
File diff suppressed because it is too large
Load Diff
5
script/build.bat
vendored
5
script/build.bat
vendored
@@ -54,8 +54,6 @@ for /f "skip=1 tokens=1-4 delims=," %%i in (app.csv) do (
|
||||
::replace pacakge name
|
||||
.\script\sd.exe !old_title! !title! src-tauri\tauri.conf.json
|
||||
.\script\sd.exe !old_name! !name! src-tauri\tauri.windows.conf.json
|
||||
echo update ico with 32x32 pictue
|
||||
.\script\sd.exe !old_name! !name! src-tauri\src\main.rs
|
||||
|
||||
echo.
|
||||
::update package info
|
||||
@@ -96,5 +94,4 @@ echo "output dir is output\windows"
|
||||
::recovery code
|
||||
.\script\sd.exe %url% %init_url% src-tauri\tauri.conf.json
|
||||
.\script\sd.exe %title% %init_title% src-tauri\tauri.conf.json
|
||||
.\script\sd.exe %name% %init_name% src-tauri\tauri.windows.conf.json
|
||||
.\script\sd.exe %name% %init_name% src-tauri\src\main.rs
|
||||
.\script\sd.exe %name% %init_name% src-tauri\tauri.windows.conf.json
|
||||
4
script/build.sh
vendored
4
script/build.sh
vendored
@@ -69,8 +69,8 @@ do
|
||||
# replace package info
|
||||
$sd "${old_url}" "${url}" src-tauri/tauri.conf.json
|
||||
$sd "${old_name}" "${package_name}" src-tauri/tauri.conf.json
|
||||
echo "update ico with 32x32 pictue"
|
||||
$sd "${old_name}" "${package_name}" src-tauri/src/main.rs
|
||||
# echo "update ico with 32x32 pictue"
|
||||
# $sd "${old_name}" "${package_name}" src-tauri/src/main.rs
|
||||
|
||||
# for apple, need replace title
|
||||
if [[ "$OSTYPE" =~ ^darwin ]]; then
|
||||
|
||||
@@ -95,6 +95,8 @@ fn main() -> wry::Result<()> {
|
||||
..
|
||||
} = windows_config.unwrap_or_default();
|
||||
#[cfg(target_os = "windows")]
|
||||
let (package_name, windows_config) = get_windows_config();
|
||||
#[cfg(target_os = "windows")]
|
||||
let WindowConfig {
|
||||
url,
|
||||
width,
|
||||
@@ -102,7 +104,7 @@ fn main() -> wry::Result<()> {
|
||||
resizable,
|
||||
fullscreen,
|
||||
..
|
||||
} = get_windows_config().unwrap_or_default();
|
||||
} = windows_config.unwrap_or_default();
|
||||
#[cfg(target_os = "macos")]
|
||||
let WindowConfig {
|
||||
url,
|
||||
@@ -112,7 +114,7 @@ fn main() -> wry::Result<()> {
|
||||
transparent,
|
||||
fullscreen,
|
||||
..
|
||||
} = get_windows_config().unwrap_or_default();
|
||||
} = get_windows_config().1.unwrap_or_default();
|
||||
let event_loop = EventLoop::new();
|
||||
|
||||
let common_window = WindowBuilder::new()
|
||||
@@ -125,7 +127,12 @@ fn main() -> wry::Result<()> {
|
||||
})
|
||||
.with_inner_size(wry::application::dpi::LogicalSize::new(width, height));
|
||||
#[cfg(target_os = "windows")]
|
||||
let icon = load_icon(std::path::Path::new("png/weread_32.ico"));
|
||||
let package_name = package_name.expect("can't get package name in config file").to_lowercase();
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
let icon_path = format!("png/{}_32.ico", package_name);
|
||||
#[cfg(target_os = "windows")]
|
||||
let icon = load_icon(std::path::Path::new(&icon_path));
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
let window = common_window
|
||||
|
||||
Reference in New Issue
Block a user