On Mon, Mar 28, 2016 at 9:46 AM, Alex Vong <alexvong1...@gmail.com> wrote: > "Thompson, David" <dthomps...@worcester.edu> writes: > >> On Mon, Mar 28, 2016 at 6:00 AM, Alex Vong <alexvong1...@gmail.com> wrote: >>> Hi, >>> >>> Chris Marusich <cmmarus...@gmail.com> writes: >>> >>>> Hi, >>>> >>>> Info node "(guile) File System" describes a procedure for getting the >>>> preferred file name separator of the operating system: >>>> >>>> -- Scheme Variable: file-name-separator-string >>>> The preferred file name separator. >>>> >>>> Note that on MinGW builds for Windows, both ‘/’ and ‘\’ are valid >>>> separators. Thus, programs should not assume that >>>> ‘file-name-separator-string’ is the _only_ file name >>>> separator—e.g., when extracting the components of a file name. >>>> >>>> >>>> Is there an equivalent procedure for getting the preferred environment >>>> variable path separator, too? I would expect such a procedure to return >>>> the ":" string (or does it return a character?) on most GNU/Linux >>>> distributions, since that is the separator e.g. for the PATH environment >>>> variable. >>>> >>> I can't find one either. If the machine has perl/python, you could try >>> (use-modules (ice-9 rdelim) (ice-9 popen)) >>> (read-line (open-pipe* OPEN_READ >>> "perl" >>> "-e" >>> "use Config; print $Config{path_sep}")) >>> or >>> (use-modules (ice-9 rdelim) (ice-9 popen)) >>> (read-line (open-pipe* OPEN_READ >>> "python" >>> "-c" >>> "import os; print(os.pathsep)")) >> >> Please don't do this. Use file-name-separator-string. Section 7.2.3 >> in the manual, titled "File System". In Emacs, you can press 'i' to >> search the manual for identifiers. >> >> Another way of finding out things like this is to use the REPL: >> >> scheme@(guile-user)> ,a separator >> (guile): file-name-separator-string >> (guile): file-name-separator? #<procedure file-name-separator? (c)> >> scheme@(guile-user)> file-name-separator-string >> $2 = "/" >> > I think Christ is asking for ":" instead of "/", do we have environment > path separator in Guile?
Sorry, I misunderstood. The environment variable path separator is *not* defined depending on the OS. It is up to the programs that interpret these search paths to specify what the separator should be. ":" is the most common separator, but that is just convention. A search path is opaque to the operating system, where environment variables are just strings with no inherent meaning. Hope this helps. - Dave