Mercurial > hg > xemacs-beta
comparison src/nt.c @ 819:6504113e7c2d
[xemacs-hg @ 2002-04-25 18:03:23 by andyp]
sync up windows branch from 21.4
author | andyp |
---|---|
date | Thu, 25 Apr 2002 18:04:24 +0000 |
parents | a634e3b7acc8 |
children | e7ee5f8bde58 |
comparison
equal
deleted
inserted
replaced
818:accc481aef34 | 819:6504113e7c2d |
---|---|
1456 DWORD fake_inode; | 1456 DWORD fake_inode; |
1457 int permission; | 1457 int permission; |
1458 Bytecount len; | 1458 Bytecount len; |
1459 int rootdir = FALSE; | 1459 int rootdir = FALSE; |
1460 Extbyte *nameext; | 1460 Extbyte *nameext; |
1461 int errm; | |
1461 | 1462 |
1462 if (path == NULL || buf == NULL) | 1463 if (path == NULL || buf == NULL) |
1463 { | 1464 { |
1464 errno = EFAULT; | 1465 errno = EFAULT; |
1465 return -1; | 1466 return -1; |
1466 } | 1467 } |
1467 | 1468 |
1468 name = qxestrcpy (alloca_intbytes (qxestrlen (path) + 10), path); | 1469 name = qxestrcpy (alloca_intbytes (qxestrlen (path) + 10), path); |
1470 errm = SetErrorMode (SEM_FAILCRITICALERRORS | |
1471 | SEM_NOOPENFILEERRORBOX); | |
1469 | 1472 |
1470 get_volume_info (name, &path); | 1473 get_volume_info (name, &path); |
1471 /* must be valid filename, no wild cards or other invalid characters */ | 1474 /* must be valid filename, no wild cards or other invalid characters */ |
1472 if (qxestrpbrk (name, "*?|<>\"")) | 1475 if (qxestrpbrk (name, "*?|<>\"")) |
1473 { | 1476 { |
1509 if (!IS_DIRECTORY_SEP (name[len-1])) | 1512 if (!IS_DIRECTORY_SEP (name[len-1])) |
1510 qxestrcat (name, (Intbyte *) "\\"); | 1513 qxestrcat (name, (Intbyte *) "\\"); |
1511 C_STRING_TO_TSTR (name, nameext); | 1514 C_STRING_TO_TSTR (name, nameext); |
1512 if (qxeGetDriveType (nameext) < 2) | 1515 if (qxeGetDriveType (nameext) < 2) |
1513 { | 1516 { |
1517 SetErrorMode (errm); | |
1514 errno = ENOENT; | 1518 errno = ENOENT; |
1515 return -1; | 1519 return -1; |
1516 } | 1520 } |
1517 memset (&wfd, 0, sizeof (wfd)); | 1521 memset (&wfd, 0, sizeof (wfd)); |
1518 wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; | 1522 wfd.dwFileAttributes = FILE_ATTRIBUTE_DIRECTORY; |
1550 { | 1554 { |
1551 C_STRING_TO_TSTR (name, nameext); | 1555 C_STRING_TO_TSTR (name, nameext); |
1552 fh = qxeFindFirstFile (nameext, &wfd); | 1556 fh = qxeFindFirstFile (nameext, &wfd); |
1553 if (fh == INVALID_HANDLE_VALUE) | 1557 if (fh == INVALID_HANDLE_VALUE) |
1554 { | 1558 { |
1559 SetErrorMode (errm); | |
1555 errno = ENOENT; | 1560 errno = ENOENT; |
1556 return -1; | 1561 return -1; |
1557 } | 1562 } |
1558 FindClose (fh); | 1563 FindClose (fh); |
1559 /* XEmacs: Don't need to convert wfd.cFileName because | 1564 /* XEmacs: Don't need to convert wfd.cFileName because |
1618 buf->st_mode = _S_IFREG; | 1623 buf->st_mode = _S_IFREG; |
1619 buf->st_nlink = 1; | 1624 buf->st_nlink = 1; |
1620 fake_inode = 0; | 1625 fake_inode = 0; |
1621 } | 1626 } |
1622 } | 1627 } |
1628 | |
1629 SetErrorMode (errm); | |
1623 | 1630 |
1624 #if 0 | 1631 #if 0 |
1625 /* XEmacs: Removed the fake-inodes code here, which was if 0'd out. | 1632 /* XEmacs: Removed the fake-inodes code here, which was if 0'd out. |
1626 If you want it, look in w32.c in Emacs 20.6. */ | 1633 If you want it, look in w32.c in Emacs 20.6. */ |
1627 #endif | 1634 #endif |