An initial `~/' expands to your home directory.\n\
An initial `~USER/' expands to USER's home directory.\n\
See also the function `substitute-in-file-name'.")
- (name, default_directory)
+ (name, default_directory)
Lisp_Object name, default_directory;
{
unsigned char *nm;
/* Use the buffer's default-directory if DEFAULT_DIRECTORY is omitted. */
if (NILP (default_directory))
default_directory = current_buffer->directory;
- CHECK_STRING (default_directory, 1);
+ if (! STRINGP (default_directory))
+ default_directory = build_string ("/");
if (!NILP (default_directory))
{
}
/* Keep only a prefix from newdir if nm starts with slash
- (//server/share for UNC, nothing otherwise). */
+ (//server/share for UNC, nothing otherwise). */
if (IS_DIRECTORY_SEP (nm[0]) && collapse_newdir)
{
#ifdef WINDOWSNT
if (newdir)
{
/* Get rid of any slash at the end of newdir, unless newdir is
- just // (an incomplete UNC name). */
+ just // (an incomplete UNC name). */
length = strlen (newdir);
if (length > 0 && IS_DIRECTORY_SEP (newdir[length - 1])
#ifdef WINDOWSNT
else if (IS_DIRECTORY_SEP (p[0]) && IS_DIRECTORY_SEP (p[1])
#if defined (APOLLO) || defined (WINDOWSNT)
/* // at start of filename is meaningful in Apollo
- and WindowsNT systems */
+ and WindowsNT systems. */
&& o != target
#endif /* APOLLO || WINDOWSNT */
)
nm = XSTRING (name)->data;
/* If nm is absolute, flush ...// and detect /./ and /../.
- If no /./ or /../ we can return right away. */
+ If no /./ or /../ we can return right away. */
if (
nm[0] == '/'
#ifdef VMS
{
if (p[0] == '/' && p[1] == '/'
#ifdef APOLLO
- /* // at start of filename is meaningful on Apollo system */
+ /* // at start of filename is meaningful on Apollo system. */
&& nm != p
#endif /* APOLLO */
)
}
else if (!strncmp (p, "//", 2)
#ifdef APOLLO
- /* // at start of filename is meaningful in Apollo system */
+ /* // at start of filename is meaningful in Apollo system. */
&& o != target
#endif /* APOLLO */
)
#endif
endp = nm + XSTRING (filename)->size;
- /* If /~ or // appears, discard everything through first slash. */
+ /* If /~ or // appears, discard everything through first slash. */
for (p = nm; p != endp; p++)
{
if ((p[0] == '~'
#if defined (APOLLO) || defined (WINDOWSNT)
/* // at start of file name is meaningful in Apollo and
- WindowsNT systems */
+ WindowsNT systems. */
|| (IS_DIRECTORY_SEP (p[0]) && p - 1 != nm)
#else /* not (APOLLO || WINDOWSNT) */
|| IS_DIRECTORY_SEP (p[0])
*x = 0;
- /* If /~ or // appears, discard everything through first slash. */
+ /* If /~ or // appears, discard everything through first slash. */
for (p = xnm; p != x; p++)
if ((p[0] == '~'