Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: use pathToFileURL instead of regular URLs for cross-platform support #39

Merged
merged 2 commits into from
Oct 7, 2024

Conversation

brw
Copy link
Member

@brw brw commented Oct 7, 2024

https://nodejs.org/api/url.html#urlpathtofileurlpath-options

Least amount of changes to get bg images working on every platform.

I'm honestly not entirely sure what the point of resource::getPath is when we always seem to pass an absolute path to it anyway. But I guess now the point is to run pathToFileURL on it which is only available in Node and not in the browser.

I feel like we could just store these bg and media file URLs on the Song object instead, maybe even in place of the regular paths if we only use them as URLs anyway (I'm not entirely sure if this is the case). Seems a bit useless to have a round-trip for every song element just to convert its paths to file:// URLs (if that's all that's happening, maybe I'm missing something).

Doing this for Linux support for myself. Tested on macOS and Windows by @Tnixc, but you do have to clear your local app data for it if you still had it from before the db branch was merged.

@brw brw requested a review from CaptSiro as a code owner October 7, 2024 20:58
@CaptSiro
Copy link
Collaborator

CaptSiro commented Oct 7, 2024

Thank you for contributing :btmcLuv:

@CaptSiro CaptSiro merged commit 9fcb78b into master Oct 7, 2024
1 check passed
@brw brw deleted the fix/get-path-file-url branch October 7, 2024 22:13
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.

2 participants