fix absolute_file_name
git-svn-id: https://yap.svn.sf.net/svnroot/yap/trunk@1937 b08c6af1-5177-4d33-ba66-4b1c6b8b522a
This commit is contained in:
38
C/iopreds.c
38
C/iopreds.c
@@ -2143,24 +2143,38 @@ check_bom(int sno, StreamDesc *st)
|
||||
}
|
||||
}
|
||||
|
||||
static Int
|
||||
p_access(char *file_name)
|
||||
{
|
||||
#if HAVE_STAT
|
||||
#if _MSC_VER || defined(__MINGW32__)
|
||||
struct _stat ss;
|
||||
if (_stat(file_name, &ss) != 0) {
|
||||
#define SYSTEM_STAT _stat
|
||||
#else
|
||||
struct stat ss;
|
||||
if (stat(file_name, &ss) != 0) {
|
||||
#define SYSTEM_STAT stat
|
||||
#endif
|
||||
/* ignore errors while checking a file */
|
||||
|
||||
static Int
|
||||
p_access(void)
|
||||
{
|
||||
Term tname = Deref(ARG1);
|
||||
char *file_name;
|
||||
|
||||
if (IsVarTerm(tname)) {
|
||||
Yap_Error(INSTANTIATION_ERROR, tname, "access");
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
} else if (!IsAtomTerm (tname)) {
|
||||
Yap_Error(TYPE_ERROR_ATOM, tname, "access");
|
||||
return FALSE;
|
||||
} else {
|
||||
#if HAVE_STAT
|
||||
struct SYSTEM_STAT ss;
|
||||
|
||||
file_name = RepAtom(AtomOfTerm(tname))->StrOfAE;
|
||||
if (SYSTEM_STAT(file_name, &ss) != 0) {
|
||||
/* ignore errors while checking a file */
|
||||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
#else
|
||||
return FALSE;
|
||||
return FALSE;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
static Int
|
||||
|
||||
Reference in New Issue
Block a user