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

PathBuf and OsStr use - not String #25

Closed
jrgerber opened this issue Mar 23, 2021 · 3 comments · Fixed by #29
Closed

PathBuf and OsStr use - not String #25

jrgerber opened this issue Mar 23, 2021 · 3 comments · Fixed by #29
Assignees
Labels
bug Something isn't working

Comments

@jrgerber
Copy link
Owner

jrgerber commented Mar 23, 2021

There are some functions which take file paths as Strings. These should probably be using PathBuf and OsStr. Different OS's treat paths differently with \ or / for example and possibly some characters are invalid between them.

Review the existing API's that DMIDECODE uses for file paths from smbios-lib and make them both use proper types to describe paths.

https://doc.rust-lang.org/std/path/struct.PathBuf.html
https://doc.rust-lang.org/std/ffi/struct.OsString.html

@jrgerber jrgerber added the bug Something isn't working label Mar 23, 2021
@jczuluag jczuluag self-assigned this Mar 27, 2021
@jczuluag
Copy link
Collaborator

@jrgerber , are these functions consumed by dmidecode-rs? If that is the case should be this bug move to the lib repo?

@jrgerber
Copy link
Owner Author

@jrgerber , are these functions consumed by dmidecode-rs? If that is the case should be this bug move to the lib repo?

Yes, and that will create work here too.

I noticed structopt was using PathBuf when reading from the command line. Path::from_string() I think knows to accept \ or / . The branch I am working in on smbios-lib I've started playing with using Path. The reason is cross-platform compatibility and accepting things which are paths and not just any string.

@jczuluag
Copy link
Collaborator

@jrgerber , are these functions consumed by dmidecode-rs? If that is the case should be this bug move to the lib repo?

Yes, and that will create work here too.

I noticed structopt was using PathBuf when reading from the command line. Path::from_string() I think knows to accept \ or / . The branch I am working in on smbios-lib I've started playing with using Path. The reason is cross-platform compatibility and accepting things which are paths and not just any string.

Cool, I opened: jrgerber/smbios-lib#47

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants