file fixes
This commit is contained in:
parent
9b38290b8c
commit
d83c62051b
@ -17,7 +17,7 @@
|
|||||||
#define YAP_HANDLES_H 1
|
#define YAP_HANDLES_H 1
|
||||||
|
|
||||||
#include "Regs.h"
|
#include "Regs.h"
|
||||||
#include "YAtom.h"
|
#include "Yatom.h"
|
||||||
|
|
||||||
#define LOCAL_CurHandle LOCAL_CurSlot
|
#define LOCAL_CurHandle LOCAL_CurSlot
|
||||||
#define REMOTE_CurHandle REMOTE_CurSlot
|
#define REMOTE_CurHandle REMOTE_CurSlot
|
||||||
|
27
os/sysbits.c
27
os/sysbits.c
@ -631,7 +631,6 @@ Yap_AbsoluteFile(const char *spec, char *tmp, bool ok)
|
|||||||
*
|
*
|
||||||
* @param PrologPath the source, may be atom or string
|
* @param PrologPath the source, may be atom or string
|
||||||
* @param ExpandVars expand initial occurrence of ~ or $
|
* @param ExpandVars expand initial occurrence of ~ or $
|
||||||
* @param ExpandVars expand initial occurrence of ~ or $
|
|
||||||
* @param Prefix add this path before _PrologPath_
|
* @param Prefix add this path before _PrologPath_
|
||||||
* @param OSPath pathname.
|
* @param OSPath pathname.
|
||||||
*
|
*
|
||||||
@ -676,7 +675,6 @@ prolog_expanded_file_system_path( USES_REGS1 )
|
|||||||
return Yap_unify(MkAtomTerm(Yap_LookupAtom(rc)), ARG4);
|
return Yap_unify(MkAtomTerm(Yap_LookupAtom(rc)), ARG4);
|
||||||
} else {
|
} else {
|
||||||
char *pt =strncpy( LOCAL_FileNameBuf2, p0, YAP_FILENAME_MAX );
|
char *pt =strncpy( LOCAL_FileNameBuf2, p0, YAP_FILENAME_MAX );
|
||||||
printf("%s\n", LOCAL_FileNameBuf2);
|
|
||||||
if ( !dir_separator( pt[-1] )) {
|
if ( !dir_separator( pt[-1] )) {
|
||||||
#if ATARI || _MSC_VER || defined(__MINGW32__)
|
#if ATARI || _MSC_VER || defined(__MINGW32__)
|
||||||
pt[0] = '\\';
|
pt[0] = '\\';
|
||||||
@ -687,7 +685,7 @@ prolog_expanded_file_system_path( USES_REGS1 )
|
|||||||
pt[0] = '\n';
|
pt[0] = '\n';
|
||||||
}
|
}
|
||||||
out = strncpy( pt, out, YAP_FILENAME_MAX -(pt -LOCAL_FileNameBuf2) );
|
out = strncpy( pt, out, YAP_FILENAME_MAX -(pt -LOCAL_FileNameBuf2) );
|
||||||
const char *rc = myrealpath(LOCAL_FileNameBuf2, LOCAL_FileNameBuf );
|
const char *rc = myrealpath(LOCAL_FileNameBuf, LOCAL_FileNameBuf2 );
|
||||||
return Yap_unify(MkAtomTerm(Yap_LookupAtom(rc)), ARG4);
|
return Yap_unify(MkAtomTerm(Yap_LookupAtom(rc)), ARG4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -760,12 +758,6 @@ do_expand_file_name(Term t1, Term opts USES_REGS)
|
|||||||
return TermNil;
|
return TermNil;
|
||||||
}
|
}
|
||||||
tmpe = expandVars( spec, tmpe, YAP_FILENAME_MAX);
|
tmpe = expandVars( spec, tmpe, YAP_FILENAME_MAX);
|
||||||
#ifdef GLOB_BRACE
|
|
||||||
flags = GLOB_BRACE|GLOB_TILDE;
|
|
||||||
#endif
|
|
||||||
//#ifdef GLOB_NOCHECK
|
|
||||||
// flags |= GLOB_NOCHECK;
|
|
||||||
//#endif
|
|
||||||
spec = tmpe;
|
spec = tmpe;
|
||||||
} else if (t == TermTrue) {
|
} else if (t == TermTrue) {
|
||||||
use_system_expansion = true;
|
use_system_expansion = true;
|
||||||
@ -777,7 +769,7 @@ do_expand_file_name(Term t1, Term opts USES_REGS)
|
|||||||
if (!use_system_expansion) {
|
if (!use_system_expansion) {
|
||||||
use_system_expansion = true;
|
use_system_expansion = true;
|
||||||
#ifdef WRDE_NOCMD
|
#ifdef WRDE_NOCMD
|
||||||
if (t == TermFalse) {
|
if (t == TermFalse) {`
|
||||||
flags = WRDE_NOCMD;
|
flags = WRDE_NOCMD;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -835,8 +827,15 @@ do_expand_file_name(Term t1, Term opts USES_REGS)
|
|||||||
size_t pathcount;
|
size_t pathcount;
|
||||||
if ( glob_vs_wordexp ) {
|
if ( glob_vs_wordexp ) {
|
||||||
#if HAVE_GLOB
|
#if HAVE_GLOB
|
||||||
memset( &gresult,0,sizeof(gresult) );
|
#ifdef GLOB_NOCHECK
|
||||||
switch (glob (spec, flags, NULL, &gresult))
|
flags = GLOB_NOCHECK;
|
||||||
|
#else
|
||||||
|
flags = 0;
|
||||||
|
#endif
|
||||||
|
#ifdef GLOB_BRACE
|
||||||
|
flags |= GLOB_BRACE|GLOB_TILDE;
|
||||||
|
#endif
|
||||||
|
switch (glob (spec, flags, NULL, &gresult))
|
||||||
{
|
{
|
||||||
case 0: /* Successful. */
|
case 0: /* Successful. */
|
||||||
ss = gresult.gl_pathv;
|
ss = gresult.gl_pathv;
|
||||||
@ -902,9 +901,9 @@ do_expand_file_name(Term t1, Term opts USES_REGS)
|
|||||||
#else
|
#else
|
||||||
tmp = s;
|
tmp = s;
|
||||||
#endif
|
#endif
|
||||||
//if (!exists(s))
|
//if (!exists(s))
|
||||||
// continue;
|
// continue;
|
||||||
Atom a = Yap_LookupAtom(s);
|
Atom a = Yap_LookupAtom(tmp);
|
||||||
tf = MkPairTerm(MkAtomTerm( a ),tf);
|
tf = MkPairTerm(MkAtomTerm( a ),tf);
|
||||||
}
|
}
|
||||||
#if HAVE_GLOB
|
#if HAVE_GLOB
|
||||||
|
@ -303,7 +303,7 @@ absolute_file_name(File0,File) :-
|
|||||||
atom_codes(DA,[D]),
|
atom_codes(DA,[D]),
|
||||||
atom_concat( [File1, DA, Glob], File2 ),
|
atom_concat( [File1, DA, Glob], File2 ),
|
||||||
expand_file_name(File2, ExpFiles),
|
expand_file_name(File2, ExpFiles),
|
||||||
% glob is not very much into failing
|
% glob is not very much into failing
|
||||||
%[File2] \== ExpFiles,
|
%[File2] \== ExpFiles,
|
||||||
'$enumerate_glob'(File2, ExpFiles, ExpFile)
|
'$enumerate_glob'(File2, ExpFiles, ExpFile)
|
||||||
;
|
;
|
||||||
|
Reference in New Issue
Block a user