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

Feature request: a path class #456

Open
amtopel opened this issue Aug 1, 2024 · 3 comments
Open

Feature request: a path class #456

amtopel opened this issue Aug 1, 2024 · 3 comments
Labels
feature-request New feature or request

Comments

@amtopel
Copy link

amtopel commented Aug 1, 2024

I'm not sure if this has been brought up, or if something like this already exists in the library, but I thought it would be very helpful to have a comprehensive "path" class. ATL's CPathT is pretty good, but it would be nice to build on that with additional methods pertaining to PathCreateFromUrl, UrlCreateFromPath, SHGetKnownFolderPath, GetModuleFileName, GetTempPath, etc.

@dunhor
Copy link
Member

dunhor commented Aug 1, 2024

This has been a longstanding desire of mine. std::filesystem::path is both inefficient and doesn't handle many Win32-isms properly (such as extended length paths) that I've effectively stopped using it. Perhaps one of these days I'll find the time to finish implementing one

@dunhor dunhor added the feature-request New feature or request label Aug 1, 2024
@jonwis
Copy link
Member

jonwis commented Aug 8, 2024

Sure, a reasonable set of helpers around a counted buffer plus use of the PathCch family of APIs?

@amtopel
Copy link
Author

amtopel commented Aug 8, 2024

Sure, a reasonable set of helpers around a counted buffer plus use of the PathCch family of APIs?

Well that would be good, but then you might as well use ATL's CPathT. My recommendation would be to add functions that are missing from CPathT, like those mentioned above, plus routine things that don't necessarily correspond to a single API function. For example:

  • getting the directory of the current module (as opposed to the current working directory)
  • getting the path to other files in the directory of the current module
  • creating temporary file paths using GUIDs (as recommended in the docs)
  • determining whether the path is a descendant of another path
  • having a "merge" function (as opposed to just append)
  • overloading operator+

I'd share my own code for this stuff (I've created a CPath2), but it's not very professional looking.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants