app-dirs-rs
app-dirs-rs copied to clipboard
Rename functions
They're kind of terrible, and I think I have a better scheme now:
app_dir->ensure_app_dirget_app_dir->compute_app_dir
Discussion is very welcome...
Thank you for opening up this discussion! I'm using your crate, and really satisfied with the functionality. I'd have a bit of input in this, but what it has isn't that bad I'd say - might be slightly confusing with app_dir defaulting to creating something, but then again that is a reasonable default.
I'm not at all sure what the best names would be, but have you seen https://github.com/rust-lang/rfcs/blob/master/text/0356-no-module-prefixes.md? It's a guideline on things in the standard library, but I think it might be a good thing to apply to crates as well.
The ensure_app_dir and compute_app_dir definitely seem better than the current names to me - I certainly can't think of anything better at the moment, but part of me does want to have the methods without 'app' in them.
If I was to come up with names from scratch, I would probably do something like the following (I don't think these would be good to change to now, just giving some input to the discussion of possibilities):
get_data_root->data_rootdata_root->create_data_rootget_app_root->dirapp_root->create_dirget_app_dir->sub_dirapp_dir->create_sub_dir
create_ slightly mirrors what std does with File::create (create a file only if it does not exist).