fix(linux): restore legacy CUPS capture compatibility
Some checks failed
Desktop Release / Bootstrap updater signing key (push) Has been cancelled
Desktop Release / Windows x64 NSIS (push) Has been cancelled
Desktop Release / Linux x64 DEB + AppImage (push) Has been cancelled
Desktop Release / Publish public desktop release (push) Has been cancelled

This commit is contained in:
Admin 2026-09-26 03:05:24 +00:00
parent 0da470e66d
commit 68052a11ef
4 changed files with 23 additions and 18 deletions

View File

@ -1,6 +1,6 @@
{
"name": "@fieldlens/print",
"version": "0.1.25",
"version": "0.1.26",
"private": true,
"type": "module",
"scripts": {

View File

@ -1,6 +1,6 @@
[package]
name = "fieldlens-print"
version = "0.1.25"
version = "0.1.26"
description = "FieldLens print-stream barcode capture companion"
authors = ["Arrowstack"]
edition = "2021"

View File

@ -28,6 +28,8 @@ use crate::{
#[cfg(target_os = "linux")]
const SYSTEM_CUPS_SPOOL_DIR: &str = "/var/lib/fieldlens-print/capture";
#[cfg(target_os = "linux")]
const LEGACY_CUPS_SPOOL_DIR: &str = "/var/cache/cups/fieldlens-print";
#[cfg(target_os = "linux")]
const TEST_CAPTURE_SINK_ADDR: &str = "127.0.0.1:9101";
pub struct CaptureRuntime {
@ -65,7 +67,8 @@ pub fn start(config: AppConfig, state: SharedState, app: AppHandle) -> Result<Ca
if matches!(config.mode, CaptureMode::SpoolFolder | CaptureMode::Both) {
let spool_dir = PathBuf::from(&config.spool_dir);
#[cfg(target_os = "linux")]
let is_system_cups_spool = spool_dir == PathBuf::from(SYSTEM_CUPS_SPOOL_DIR);
let is_system_cups_spool = spool_dir == PathBuf::from(SYSTEM_CUPS_SPOOL_DIR)
|| spool_dir == PathBuf::from(LEGACY_CUPS_SPOOL_DIR);
#[cfg(not(target_os = "linux"))]
let is_system_cups_spool = false;
@ -93,20 +96,22 @@ pub fn start(config: AppConfig, state: SharedState, app: AppHandle) -> Result<Ca
#[cfg(target_os = "linux")]
{
let system_spool = PathBuf::from(SYSTEM_CUPS_SPOOL_DIR);
let worker_stop = stop.clone();
let worker_state = state.clone();
let worker_app = app.clone();
let worker_config = config.clone();
handles.push(thread::spawn(move || {
cups_cache_folder_loop(
system_spool,
worker_config,
worker_state,
worker_app,
worker_stop,
)
}));
for spool in [SYSTEM_CUPS_SPOOL_DIR, LEGACY_CUPS_SPOOL_DIR] {
let system_spool = PathBuf::from(spool);
let worker_stop = stop.clone();
let worker_state = state.clone();
let worker_app = app.clone();
let worker_config = config.clone();
handles.push(thread::spawn(move || {
cups_cache_folder_loop(
system_spool,
worker_config,
worker_state,
worker_app,
worker_stop,
)
}));
}
let sink = TcpListener::bind(TEST_CAPTURE_SINK_ADDR)
.with_context(|| format!("bind test-capture sink {TEST_CAPTURE_SINK_ADDR}"))?;

View File

@ -1,7 +1,7 @@
{
"$schema": "https://schema.tauri.app/config/2",
"productName": "FieldLens Print",
"version": "0.1.25",
"version": "0.1.26",
"identifier": "dev.arrowstack.fieldlens.print",
"build": {
"beforeDevCommand": "npm run dev",