does not parse ~
Closed this issue · 1 comments
unix users are used to ~ as the home directory of the user and to reference paths from there
standard dart.io is not able to cope with ~, since path is able to make absolute paths out of relative ones, it would be nice if it could cope with ~....
ATM i do:
fname = fname.replaceFirst('~', Platform.environment['HOME'].toString());
fname = path.canonicalize(fname);
but that extra step seems silly and IMHO should be included in the lib?
I don't think path
is the right place for that functionality, it's not exactly aligned with making a path absolute. I can see how it might be related to canonicalization, but I don't know what everyone who need canonicalization would expect or want that behavior.
The replaceFirst
implementation is not sufficient to match the POSIX spec for tilde expansion. https://pubs.opengroup.org/onlinepubs/9699919799.2018edition/utilities/V3_chap02.html#tag_18_06_01
I think it could be worthwhile for someone to publish a well written implementation of tilde expansion, , but I don't think we have a need for one in Dart team tools.