[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to get the preferred environment variable path separator?

From: Alex Vong
Subject: Re: How to get the preferred environment variable path separator?
Date: Mon, 28 Mar 2016 21:46:15 +0800
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.5 (gnu/linux)

"Thompson, David" <address@hidden> writes:

> On Mon, Mar 28, 2016 at 6:00 AM, Alex Vong <address@hidden> wrote:
>> Hi,
>> Chris Marusich <address@hidden> 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?
> - Dave

reply via email to

[Prev in Thread] Current Thread [Next in Thread]