feat: Improve cross-platform compatibility#5
Open
mopemope wants to merge 1 commit intotimvancann:mainfrom
Open
feat: Improve cross-platform compatibility#5mopemope wants to merge 1 commit intotimvancann:mainfrom
mopemope wants to merge 1 commit intotimvancann:mainfrom
Conversation
…dow configuration, and log file paths.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.