Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .