orhun/binsider

Support displaying general file information on Windows

Open

#35 opened on Sep 17, 2024

View on GitHub
 (0 comments) (1 reaction) (0 assignees)Rust (105 forks)auto 404
effort: mediumenhancementgood first issuehelp wanted

Repository metrics

Stars
 (4,333 stars)
PR merge metrics
 (PR metrics pending)

Description

Is your feature request related to a problem? Please describe.

binsider now support Windows (when building via --no-default-features) after #31, however the general file information is not available due to the Rust API differences between Linux.

See the failed workflow for more information: https://github.com/orhun/binsider/actions/runs/10902683795/job/30255132721?pr=31

We need to solve these build errors via refactoring file.rs in a more generic way.

Unfortunately I don't have a development environment for Windows and running the following command again and again on Linux is not very convenient for developing/testing this:

cross build --target x86_64-pc-windows-gnu --no-default-features

Describe the solution you'd like

One idea is to create a trait called PlatformFileInfo (I'm bad at naming) and implement it for FileInfo for having generalized functions for both Linux and Windows. Eventually update ui.rs and other related files to render the file information correctly.

To do this, one should also remove the if cfg!(target_os = "windows") checks. See 83657f98b783286f04a5b9c75b36246582f31d42 for more information.

Describe alternatives you've considered

None. I'm open to ideas though!

Additional context

See:

https://doc.rust-lang.org/stable/std/os/linux/fs/trait.MetadataExt.html

vs

https://doc.rust-lang.org/stable/std/os/windows/fs/trait.MetadataExt.html

Contributor guide