fix(linux): always watch CUPS capture cache
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
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:
parent
0e619753f1
commit
75e5d36f70
@ -63,44 +63,49 @@ 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);
|
||||
fs::create_dir_all(&spool_dir)
|
||||
.with_context(|| format!("create spool capture directory {}", spool_dir.display()))?;
|
||||
#[cfg(target_os = "linux")]
|
||||
let is_system_cups_spool = spool_dir == PathBuf::from(SYSTEM_CUPS_SPOOL_DIR);
|
||||
#[cfg(not(target_os = "linux"))]
|
||||
let is_system_cups_spool = false;
|
||||
|
||||
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 || {
|
||||
spool_folder_loop(
|
||||
worker_config,
|
||||
worker_state,
|
||||
worker_app,
|
||||
worker_stop,
|
||||
None,
|
||||
"spool-folder",
|
||||
false,
|
||||
)
|
||||
}));
|
||||
}
|
||||
if !is_system_cups_spool {
|
||||
fs::create_dir_all(&spool_dir)
|
||||
.with_context(|| format!("create spool capture directory {}", spool_dir.display()))?;
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
{
|
||||
let system_spool = PathBuf::from(SYSTEM_CUPS_SPOOL_DIR);
|
||||
if system_spool != PathBuf::from(&config.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,
|
||||
spool_folder_loop(
|
||||
worker_config,
|
||||
worker_state,
|
||||
worker_app,
|
||||
worker_stop,
|
||||
None,
|
||||
"spool-folder",
|
||||
false,
|
||||
)
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
#[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,
|
||||
)
|
||||
}));
|
||||
|
||||
let sink = TcpListener::bind(TEST_CAPTURE_SINK_ADDR)
|
||||
.with_context(|| format!("bind test-capture sink {TEST_CAPTURE_SINK_ADDR}"))?;
|
||||
|
||||
@ -37,7 +37,8 @@ job_id = safe(sys.argv[1] if len(sys.argv) > 1 else "job")
|
||||
title = safe(sys.argv[3] if len(sys.argv) > 3 else "print")
|
||||
printer = safe(os.environ.get("PRINTER", "printer"))
|
||||
prefix = "test-" if printer.lower() == "fieldlens-test-capture" else "print-"
|
||||
name = f"{prefix}{printer}-{job_id}-{title}.pdf"
|
||||
suffix = "" if title.lower().endswith(".pdf") else ".pdf"
|
||||
name = f"{prefix}{printer}-{job_id}-{title}{suffix}"
|
||||
final_path = os.path.join(CACHE, name)
|
||||
part_path = final_path + ".part"
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user