Skip to content

Commit

Permalink
fix issue where audio device on windows contains slashes
Browse files Browse the repository at this point in the history
  • Loading branch information
louis030195 committed Sep 3, 2024
1 parent 60305d3 commit 2a2e2c2
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions screenpipe-server/src/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,18 @@ async fn record_audio(
) -> Result<()> {
let mut handles: HashMap<String, JoinHandle<()>> = HashMap::new();

// fix path for audio device that contains slashes (esp. for windows crashes)
// e.g. Speakers/Headphones (Realtek High Definition Audio) should be
// Speakers_Headphones_(Realtek_High_Definition_Audio)
let output_path = PathBuf::from(output_path.as_ref())
.file_name()
.unwrap_or_default()
.to_str()
.unwrap_or_default()
.replace('/', "_");

let output_path = Arc::new(PathBuf::from(&output_path).join(output_path));

loop {
while let Some((audio_device, device_control)) = audio_devices_control.pop() {
debug!("Received audio device: {}", &audio_device);
Expand Down

0 comments on commit 2a2e2c2

Please sign in to comment.