unofficial mirror of guile-user@gnu.org 
 help / color / mirror / Atom feed
From: "Thompson, David" <dthompson2@worcester.edu>
To: Alex Vong <alexvong1995@gmail.com>
Cc: Guile User <guile-user@gnu.org>, Chris Marusich <cmmarusich@gmail.com>
Subject: Re: How to get the preferred environment variable path separator?
Date: Mon, 28 Mar 2016 08:20:24 -0400	[thread overview]
Message-ID: <CAJ=RwfbiqqLpO6_09j1CG2N4gK6Xkf6JyN1LnfsiV7VGKMSLBg@mail.gmail.com> (raw)
In-Reply-To: <87oa9yapm2.fsf@gmail.com>

On Mon, Mar 28, 2016 at 6:00 AM, Alex Vong <alexvong1995@gmail.com> wrote:
> Hi,
>
> Chris Marusich <cmmarusich@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 = "/"


>> While we're on the topic, Guile's manual has a lot of very nice,
>> detailed information about each module.  However, it does not seem to
>> tell me what the name of the modules are.  Where can I find out what the
>> name of any module described in the manual - e.g. the module which is
>> described in the Info node "(guile) POSIX"?
> I think the procedures described in (guile) POSIX are distributed in
> different modules  E.g, `open-pipe' is located in `(ice-9 popen)', while
> `chdir' is in the global namespace.

Unless otherwise specified, the procedures/variables are in the
default environment.

- Dave



  reply	other threads:[~2016-03-28 12:20 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-03-28  0:42 How to get the preferred environment variable path separator? Chris Marusich
2016-03-28 10:00 ` Alex Vong
2016-03-28 12:20   ` Thompson, David [this message]
2016-03-28 13:46     ` Alex Vong
2016-03-28 14:24       ` Thompson, David
2016-03-28 15:36         ` Paul Smith
2016-03-28 15:36         ` Eli Zaretskii
2016-03-28 15:40           ` Thompson, David
2016-03-29  7:53           ` tomas
2016-03-31  4:38         ` Chris Marusich

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/guile/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAJ=RwfbiqqLpO6_09j1CG2N4gK6Xkf6JyN1LnfsiV7VGKMSLBg@mail.gmail.com' \
    --to=dthompson2@worcester.edu \
    --cc=alexvong1995@gmail.com \
    --cc=cmmarusich@gmail.com \
    --cc=guile-user@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).