all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Michael Heerdegen <michael_heerdegen@web.de>
To: help-gnu-emacs@gnu.org
Subject: Re: Portable dir-path separator?
Date: Wed, 26 Jun 2013 20:31:00 +0200	[thread overview]
Message-ID: <878v1wsp0b.fsf@web.de> (raw)
In-Reply-To: 871u7og39w.fsf@gmail.com

Hi Thorsten,

> is it portable to split absolute file names in Emacs Lisp with "/" as
> separator? I searched for a related variable that abstracts away the
> slash vs. backslash issue, but did not find one (`path-separator' is ':'
> under GNU/Linux and probably not what I'm looking for).

I think you want something like

(defun split-path (path)
  (split-path-1 path ()))

(defun split-path-1 (path accum)
  (let ((dir  (directory-file-name (file-name-directory path)))
	(name (file-name-nondirectory path)))
    (if (equal dir path)
	accum
      (split-path-1 dir (cons name accum)))))

I totally agree that something like that could be built in.


Regards,

Michael.




  reply	other threads:[~2013-06-26 18:31 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-06-26 18:01 Portable dir-path separator? Thorsten Jolitz
2013-06-26 18:31 ` Michael Heerdegen [this message]
2013-06-26 18:56   ` Thorsten Jolitz
     [not found] <mailman.2490.1372269697.22516.help-gnu-emacs@gnu.org>
2013-06-26 18:08 ` Rustom Mody
2013-06-26 18:31   ` Thorsten Jolitz

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

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

  git send-email \
    --in-reply-to=878v1wsp0b.fsf@web.de \
    --to=michael_heerdegen@web.de \
    --cc=help-gnu-emacs@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.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.