> > I would argue that homedir should handle a user argument and provide all > of this functionality. Thus, expanduser should just deal with parsing the > path and calling homedir and homedir should do all the heavy lifting. >
Was my thinking exactly. I've made a start at this, I'll create a WIP tomorrow when I've made a couple of other changes. On Sunday, 12 October 2014 01:59:08 UTC+1, Stefan Karpinski wrote: > > I would argue that homedir should handle a user argument and provide all > of this functionality. Thus, expanduser should just deal with parsing the > path and calling homedir and homedir should do all the heavy lifting. I'm > not sure if homedir should take a positional or keyword argument – it would > often be convenient to have something like `homedir(user="name", "Library", > "path", "file")` to avoid the additional call to joinpath. > > On Oct 11, 2014, at 5:58 PM, Jameson Nash <[email protected] <javascript:>> > wrote: > > For the current user (for any platform), `~` should expand to > `Base.homedir()` > > to find the value for another user on windows (for users that are logged > in?) it is apparently best to do an ldap query: > http://www.geekshangout.com/node/27 > > On Sat, Oct 11, 2014 at 4:59 PM, Sean Marshallsay <[email protected] > <javascript:>> wrote: > >> The variable is %HOMEPATH% but I don't know what the equivalent to the >> password database is. I think for now it might be best just expanding to >> %HOMEPATH% and someone who is more experienced with Windows can weigh in >> later. >> >> On Saturday, 11 October 2014 18:54:03 UTC+1, Stefan Karpinski wrote: >>> >>> That seems like a reasonable strategy. I guess the question for Windows >>> is what the equivalents to the HOME environment variable and the password >>> database are. >>> >>> On Sat, Oct 11, 2014 at 5:54 AM, Sean Marshallsay <[email protected]> >>> wrote: >>> >>>> I've only had a quick look but basically for just a tilde it looks for >>>> $HOME, if there is no $HOME or there was a username appended it looks in >>>> the password database otherwise it returns the string unchanged. >>>> >>>> On Friday, 10 October 2014 20:23:45 UTC+1, Stefan Karpinski wrote: >>>>> >>>>> How does bash handle it? >>>>> >>>>> On Fri, Oct 10, 2014 at 3:22 PM, Sean Marshallsay <[email protected]> >>>>> wrote: >>>>> >>>>>> Hmmm... looking at how bash handles this it doesn't seem too >>>>>> difficult, I might give it a go over the weekend. I have no idea how to >>>>>> handle it on Windows though. >>>>>> >>>>>> On Thursday, 9 October 2014 18:06:07 UTC+1, Stefan Karpinski wrote: >>>>>>> >>>>>>> This is definitely a bug. The implementation on both platforms seems >>>>>>> to be a hack – a more correct implementation would be a great >>>>>>> contribution. >>>>>>> It should also be possible to map arbitrary user names to user IDs and >>>>>>> user >>>>>>> IDs to user metadata. >>>>>>> >>>>>>> On Thu, Oct 9, 2014 at 1:00 PM, Sean Marshallsay <[email protected]> >>>>>>> wrote: >>>>>>> >>>>>>>> I noticed the other day that calling expanduser on an empty string >>>>>>>> throws a BoundsError when using a UNIX platform. Whether this is a bug >>>>>>>> or a >>>>>>>> feature will probably depend entirely on who you ask. More >>>>>>>> importantly though, in my eyes, doing the same thing on Windows >>>>>>>> returns an >>>>>>>> empty string instead. This inconsistency definitely seems like a bug >>>>>>>> to me. >>>>>>>> >>>>>>>> In my eyes the UNIX implementation should be changed to check for a >>>>>>>> empty string and return it but I was wondering what other people >>>>>>>> thought of >>>>>>>> this? >>>>>>>> >>>>>>> >>>>>>> >>>>> >>> >
