Calling joinpath on various path segments before creating a final path should be valid (to preserve associativity), which means that embedded separators is a quite valid operation. On Fri, Feb 6, 2015 at 11:16 AM Seth <[email protected]> wrote:
> The thing about joinpath is that it's typically used for cross-platform > compatibility. That is, there should be NO slashes that can be interpreted > as directory separators in any component*, since some systems use a forward > slash, some a backward slash, and some use other characters like colons to > separate directories, Since you're (presumably) using joinpath to ensure > that your code works regardless of the system-specific directory delimiter, > you don't want to put any delimiters in there to begin with. > > Calling joinpath with anything other than valid FILENAME characters ought > to raise a warning or an exception. > > * This is problematic when you need to get a path relative to some root, > but we'll leave that as an edge case for now - it can be worked around via > environment variables. > > > On Thursday, February 5, 2015 at 7:12:01 PM UTC-8, [email protected] wrote: >> >> This capability would have to be provided somewhere, since its absolutely >> essential to portably handle many path manipulation use-cases (eg provide >> an absolute path or a relative path that is relative to some base path). >> IMO joinpath() is as good a place as any to have the functionality. >> >> On Friday, February 6, 2015 at 7:45:44 AM UTC+11, Milan Bouchet-Valat >> wrote: >>> >>> Le jeudi 05 février 2015 à 14:09 -0500, Stefan Karpinski a écrit : >>> > I don't see how it's magical. The function joinpath(path1,path2) gives >>> > the path of path2 relative to path1 – that's what it means. When path2 >>> > is absolute, path1 doesn't matter to answer that question. >>> Yeah, but one could also imagine raising an exception instead, as the >>> programmer may not have expected path2 to be absolute. It's not magical, >>> but maybe a little too smart for my taste for a function called >>> "joinpath". YMMV of course. >>> >>> >>> Regards >>> >>> > On Thu, Feb 5, 2015 at 2:06 PM, Milan Bouchet-Valat >>> > <[email protected]> wrote: >>> > Le jeudi 05 février 2015 à 13:55 -0500, Stefan Karpinski a >>> > écrit : >>> > > When you open the file referred to by path2, that is >>> > essentially >>> > > looking at joinpath(pwd(), path2) and this is just a >>> > generalization of >>> > > that that behavior relative to path1 instead of pwd() >>> > specifically. >>> > > This is also how Python does it, although there seems to be >>> > some >>> > > confusion due to that as well. >>> > Indeed. Isn't this behavior a bit too magical for the Julian >>> > philosophy? >>> > Is convenience worth the increased confusion here? Maybe this >>> > behavior >>> > should only be enabled via a keyword argument? >>> > >>> > >>> > Regards >>> > >>> > > On Thu, Feb 5, 2015 at 12:36 PM, Davide Lasagna >>> > > <[email protected]> wrote: >>> > > I know this is documented by what is the rationale >>> > for >>> > > joinpath(path1, path2) to return path2 if path2 >>> > looks like an >>> > > absolute path? >>> > > >>> > > Cheers, >>> > > >>> > > Davide >>> > > >>> > > >>> > > >>> > > >>> > >>> > >>> > >>> > >>> >>>
