Skip to content

feat: Improve cross-platform compatibility#5

Open
mopemope wants to merge 1 commit intotimvancann:mainfrom
mopemope:fix-linux
Open

feat: Improve cross-platform compatibility#5
mopemope wants to merge 1 commit intotimvancann:mainfrom
mopemope:fix-linux

Conversation

@mopemope
Copy link

Overview

This PR addresses several issues that prevented chordflow_desktop from being built and executed on Linux. It introduces conditional compilation for macOS-specific features, establishes a cross-platform logging path, and improves the soundfont discovery logic.

Changes

1. Build Compatibility

Conditional Compilation for macOS Methods: Wrapped macOS-only WindowBuilder methods (like with_has_shadow and with_movable_by_window_background) in #[cfg(target_os = "macos")] to fix compilation errors on Linux.
Import Cleanup: Moved macOS-specific trait imports behind conditional compilation flags.

2. Cross-Platform Logging

Linux Log Path: Updated setup_logging to use a standard Linux path (~/.local/share/chordflow/chordflow.log) instead of the macOS-specific Library path.
Directory Creation: Added logic to automatically create parent directories if they don't exist, preventing runtime crashes during initialization.

3. Improved SoundFont Discovery

Expanded Search Paths: Updated get_soundfont_path to search for TimGM6mb.sf2 in multiple locations, including:
Relative to the workspace root (chordflow_desktop/assets/).
Relative to the executable directory (improving support for portable Linux builds).
This ensures the audio system (metronome/synthesizer) initializes correctly regardless of the current working directory.

Verification

Build: Verified that cargo build -p chordflow_desktop completes successfully on Linux.
Runtime: Verified that cargo run -p chordflow_desktop launches the application, initializes the logging system, and correctly loads the soundfont without errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant