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

[windows] Windows build fails with error: metadata.dev() method not found in Metadata #69

Closed
basharovV opened this issue Jan 1, 2025 · 4 comments
Labels
windows Windows-specific issue

Comments

@basharovV
Copy link
Owner

@daiyam I tried creating a release and looks like the device check for file download uses a Unix-specific extension which is not available on Windows:

metadata.dev()
    |              ^^^ method not found in `Metadata`

Is there another way of doing this on Windows?

@basharovV basharovV added the windows Windows-specific issue label Jan 1, 2025
@basharovV
Copy link
Owner Author

Probably volume_serial_number(&self) -> Option<u32> is the function we're looking for.

basharovV added a commit that referenced this issue Jan 1, 2025
- metadata.dev() is not available on Windows, using volume_serial_number() instead
@daiyam
Copy link
Contributor

daiyam commented Jan 1, 2025

Ah!

It's due to:

#[cfg(not(target_os = "windows"))]
use std::os::unix::fs::MetadataExt;
#[cfg(target_os = "windows")]
use std::os::windows::fs::MetadataExt;

@daiyam
Copy link
Contributor

daiyam commented Jan 1, 2025

I've seen your commit. Maybe on windows, get_device_id() should just return 0?

@basharovV
Copy link
Owner Author

Looks like volume_serial_number isn't yet available in stable Rust (rust-lang/rust#63010) but there is a crate called file_id which should do the trick.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
windows Windows-specific issue
Projects
None yet
Development

No branches or pull requests

2 participants