[darcs-devel] [patch1745] use AnchoredPath instead of FileName for... (and 8 more)

Benjamin Franksen ben.franksen at online.de
Mon Nov 19 14:43:59 UTC 2018


Am 19.11.18 um 07:54 schrieb Ganesh Sittampalam:
> On 18/11/2018 23:11, Ben Franksen wrote:
>> Ben Franksen <ben.franksen at online.de> added the comment:
>>>> Is there a general guide line for when we have to use the "native" 
>>>> path separator (i.e. '\' on Windows) as opposed to the Posix one?
>>>> I am pretty sure the on-disk format of patches always uses the 
>>>> Posix separator, and similarly the index, but that's about the end
>>>> of my knowledge.
>>>
>>> I'm never very sure either. The Posix separator generally works
>>> on Windows, so probably that's a safe bet if you're not sure.
>>> I suspect that the Darcs code has just grown up organically, the
>>> main times it really needs to deal with Windows separators are
>>> when dealing with user input.
>>
>> Yes, that makes sense. What if we get a path via a system call? I'd
>> guess that will be in native format, too. I wanted to cite listing a
>> directory as example but that doesn't contain path separators (unless
>> done resursively but we do that ourselves). What about making a path
>> absolute? Oops, we also do that ourselves. Hmm, I can't think of any
>> more native sys calls which return a full path name as part of the
>> result but of course that doesn't mean there aren't any.
> 
> Yes, that was my rough thought process too. I can't think of a way
> the OS would give it a native path but I can't rule it out.

I think we can live with that. So we run the tests and see if it works.
It may be worthwhile to document all the places in the code where we use
the native System.FilePath with a short remark about why it is needed.

Cheers
Ben



More information about the darcs-devel mailing list