-
Notifications
You must be signed in to change notification settings - Fork 34
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
Provide API to get only specific directory #72
Comments
Hey Hennadii, the intention of this design was to allow a user to create this struct once with the right parameters for the given application and then be able to use the derived paths for the applications' needs, while having the guarantee that all paths where computed consistently (i. e. at the same time during the construction of struct). In the case only a single directory is needed, it's perfectly fine to use What's the source of your concerns? Cheers, Simon |
But I most of the application doesn't need all of them. This is why I suggested to allow to get directories separately. Or evaluate directories lazily.
I recently discovered standard_paths crate which have the described design. So if you disagree with the suggestion - feel free to close the issue. |
As soon as applications use more than one, it should already be cost-effective, because the expensive operations are only executed once.
Not sure I understand, that crate appears to be using roughly the approach. Am I missing something? |
You doing it once, but you create a structure with 7 directories when usually an application need 1-2. I would also create it once, but with needed directories.
I just mentioned that I already found a library (was in the README) that allow to find only specified directories as I suggested. |
With
dirs
crate I can get any directory directly. Butdirectories
provides structs and parses all directories at once. Users usually want to get a single directory. I would suggest to create separate functions as indirs
crate.The text was updated successfully, but these errors were encountered: