Skip to content

Commit 89250dd

Browse files
committed
修正语法错误和打包问题
1 parent 3536ec6 commit 89250dd

3 files changed

Lines changed: 5 additions & 16 deletions

File tree

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ jobs:
107107
cp target/release/fontsync packaging/arch/src/fontsync
108108
sed -i "s/^pkgver=.*/pkgver=${GITHUB_REF_NAME#v}/" packaging/arch/PKGBUILD
109109
docker run --rm -v "$PWD:/work" -w /work archlinux:latest bash -lc "\
110-
pacman -Sy --noconfirm base-devel zstd && \
110+
pacman -Sy --noconfirm base-devel zstd dbus pkgconf && \
111111
useradd -m build && \
112112
chown -R build:build /work && \
113113
su build -c 'cd packaging/arch && makepkg -f --nodeps --noconfirm' \

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ windows-sys = { version = "0.52.0", features = ["Win32_UI_WindowsAndMessaging",
5555
default = ["gui"]
5656
gui = ["fltk"]
5757
libappindicator = []
58+
ksni = []
5859

5960
[dependencies.fltk]
6061
version = "1.4"

src/font_installer.rs

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
use anyhow::{Context, Result};
22
use log::{error, info};
33
use std::path::Path;
4+
#[cfg(any(target_os = "linux", target_os = "macos"))]
45
use std::process::Command;
56

67
pub async fn install_font(font_path: &Path) -> Result<()> {
@@ -50,8 +51,7 @@ pub async fn install_fonts_from_directory(dir_path: &Path) -> Result<(usize, usi
5051
async fn install_font_windows(font_path: &Path) -> Result<()> {
5152
use std::fs;
5253
use windows_sys::Win32::System::Registry::{
53-
RegCloseKey, RegCreateKeyExW, RegSetValueExW, HKEY, HKEY_LOCAL_MACHINE, KEY_SET_VALUE,
54-
REG_OPTION_NON_VOLATILE, REG_SZ,
54+
RegCloseKey, RegCreateKeyW, RegSetValueExW, HKEY, HKEY_LOCAL_MACHINE, KEY_SET_VALUE, REG_SZ,
5555
};
5656

5757
info!("Installing font on Windows: {:?}", font_path);
@@ -77,19 +77,7 @@ async fn install_font_windows(font_path: &Path) -> Result<()> {
7777
let mut key: HKEY = 0;
7878
let subkey = "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\Fonts";
7979
let subkey_wide: Vec<u16> = subkey.encode_utf16().chain(std::iter::once(0)).collect();
80-
let status = unsafe {
81-
RegCreateKeyExW(
82-
HKEY_LOCAL_MACHINE,
83-
subkey_wide.as_ptr(),
84-
0,
85-
std::ptr::null_mut(),
86-
REG_OPTION_NON_VOLATILE,
87-
KEY_SET_VALUE,
88-
std::ptr::null(),
89-
&mut key,
90-
std::ptr::null_mut(),
91-
)
92-
};
80+
let status = unsafe { RegCreateKeyW(HKEY_LOCAL_MACHINE, subkey_wide.as_ptr(), &mut key) };
9381
if status != 0 {
9482
return Err(anyhow::anyhow!("Failed to open fonts registry key: {}", status));
9583
}

0 commit comments

Comments
 (0)