Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm developing a wrapper for LibGit2, the Git library.
And I come out with a problem:

Many GIT functions accept path lists, that is, a string
composed of a series of paths separated by a token,
that LibGit2 makes available to me. In my Linux, it is a colon (:).

The issue appears when I ask me:
what if the path contains this token?

Can it be escaped someway? \: or so?
Will it be supported out-of-the-box in Windows?

I know it's not common to have a directory containing : in his
name, but as a wrapper I have to be prepared for this case.

share|improve this question

1 Answer 1

up vote 1 down vote accepted

I haven't checked libgit2, but neither git nor various $PATH users – such as the Glibc execvpe() function and various shells (dash, bash) – support any form of escaping – if a directory name contains a :, it simply cannot be used as part of path-related environment variables.

On Windows, the path separator is ; – you should be able to use PATH_SEP or a similar constant to find the value – and again, escaping is not supported anywhere.

If the user gives you a path like /usr/foo:bar, then they might be expecting it to be split into two directories, so just do that.

share|improve this answer
    
Good to know. Thank you for your time! –  jmendeth Jan 26 '13 at 11:06

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.