[Top][All Lists]

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

Re: testing for a remote file to include file on a Windows mapped drive

From: Eli Zaretskii
Subject: Re: testing for a remote file to include file on a Windows mapped drive
Date: Sat, 26 Jan 2008 12:07:53 +0200

> From: "Drew Adams" <address@hidden>
> Date: Fri, 25 Jan 2008 10:47:51 -0800
> I have some code that needs to avoid some particular processing when the
> current input might name a remote file. I don't want the code to try to
> contact anything remote in this case.
> In Windows, you can map a remote directory to a virtual drive. So, for
> instance, "h:foo" or "h:/foo" might represent a remote file. But the same
> name would represent a local file if drive `h' is local, not mapped.
> How can I test in Emacs, for Windows, whether a drive is local or mapped, in
> order to determine whether "h:foo" might be local or remote?

Does it help to run "net use" and parse its output?

Note that "net use" itself might be somewhat slow, but maybe your
undisclosed processing would be much slower than that, in which case
"net use" is justified.

> I've looked at these. None does what I need.
> . file-remote-p
> . ffap-file-remote-p
> . dired-sort-menu-remote-p
>   "\\`/\\([^@:/address@hidden)?\\([^:/]+\\):"
> . ange-ftp-name-format
>   "\\`/\\(\\([^/:]*\\)@\\)?\\([^@/:]*[^@/:.]\\):\\(.*\\)"
> . remote (ange-ftp) filenames (see make-auto-save-file-name)
>   "^/address@hidden:"
> . ffap-ftp-regexp
>   "\\`/[^/:]+:"

These all make sense only in the context of the features that define
them.  In general, Emacs does not consider files on a mounted volume
to be remote.  The notion of remote files is in conjunction with Emacs
features that access files in ways that are not the normal filesystem

It sounds like you want something entirely different, but it's hard to
say what that is without knowing what are you trying to accomplish,
and why applying that to remote files would be wrong.

reply via email to

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