Code Monkey home page Code Monkey logo

Comments (10)

didoudiaz avatar didoudiaz commented on August 23, 2024 1

I could reproduce this strange behavior and I have no explanations why this occurs now. The problem comes from the use of _findfirst/_findnext (other projects report the same problem).
I confirm that turning the compatibility mode on is a workaround (after some tries, even comptatibility set to Windows 8 worked).
In next release, I'll try to use other system calls (FindFirstFile/FindNextFile) to implement directory_files.

from gprolog.

didoudiaz avatar didoudiaz commented on August 23, 2024 1

I'll look at it very soon...

from gprolog.

pmoura avatar pmoura commented on August 23, 2024

Same issue with the Windows 10 with MinGW64 gcc under MSys2 build.

from gprolog.

pmoura avatar pmoura commented on August 23, 2024

More details:

GNU Prolog 1.5.0 (64 bits)
Compiled Jul  8 2021, 12:22:53 with gcc
Copyright (C) 1999-2021 Daniel Diaz

| ?- current_directory(D).
uncaught exception: error(existence_error(procedure,current_directory/1),top_level/0)
| ?- working_directory(D).

D = 'C:\\GNU-Prolog\\bin'

yes
| ?- directory_files('C:\\GNU-Prolog\\bin', Files).

Files = ['.',..,'create_bat.exe','fd2c.exe','gplc.exe','gprolog.exe','hexgplc.exe','ma2asm.exe','pl2wam.exe','w32guicons.dll','wam2ma.exe','yasm-win64.exe']

yes
| ?- directory_files('C:/GNU-Prolog/bin', Files).

Files = ['.',..,'create_bat.exe','fd2c.exe','gplc.exe','gprolog.exe','hexgplc.exe','ma2asm.exe','pl2wam.exe','w32guicons.dll','wam2ma.exe','yasm-win64.exe']

yes

But if I start Logtalk using the "Logtalk - GNU Prolog" shortcut:

| ?- directory_files('C:\\GNU-Prolog\\bin', Files).
uncaught exception: error(system_error('No error'),directory_files/2)
| ?- directory_files('C:/GNU-Prolog/bin', Files).
uncaught exception: error(system_error('No error'),directory_files/2)

The only change to GNU Prolog defaults when running Logtalk is that the strict_iso flag is turned off. But toggling this flag doesn't solve the problem. On the other hand, if I start GNU-Prolog and then load Logtalk from the top-level:

| ?- ['C:/Program Files (x86)/Logtalk/integration/logtalk_gp.pl'].
...
Logtalk 3.49.0-b05
Copyright (c) 1998-2021 Paulo Moura
...

(468 ms) yes
| ?- directory_files('C:\\GNU-Prolog\\bin', Files).

Files = ['.',..,'create_bat.exe','fd2c.exe','gplc.exe','gprolog.exe','hexgplc.exe','ma2asm.exe','pl2wam.exe','w32guicons.dll','wam2ma.exe','yasm-win64.exe']

yes
| ?- directory_files('C:/GNU-Prolog/bin', Files).

Files = ['.',..,'create_bat.exe','fd2c.exe','gplc.exe','gprolog.exe','hexgplc.exe','ma2asm.exe','pl2wam.exe','w32guicons.dll','wam2ma.exe','yasm-win64.exe']

yes

Thus, the issue seems to be caused by how Logtalk with GNU Prolog is started. If from a Windows shortcut, directory_files/2 doesn't work. If we start GNU Prolog directly and then load Logtalk, directory_files/2 works as expected.

from gprolog.

pmoura avatar pmoura commented on August 23, 2024

Running the integration shortcut as an administrator doesn't solve the problem.

from gprolog.

pmoura avatar pmoura commented on August 23, 2024

The issue can be solved by editing the shortcut properties and then set compatibility mode to Windows 7.

from gprolog.

pmoura avatar pmoura commented on August 23, 2024

Actually, setting the shortcut compatibility mode, sets the GNU Prolog executable itself compatibility mode. Thus, it seems that the GNU Prolog installers for Windows need to ensure that the compatibility mode is set to Windows 7.

from gprolog.

pmoura avatar pmoura commented on August 23, 2024

The trick of setting the compatibility mode to Windows 7 or 8 no longer works in recent Windows 10 builds. I'm working on a portable package manager that requires a call to the directory_files/2 predicate at startup. This bug effectively prevents running the next Logtalk release with GNU Prolog on Windows 10.

from gprolog.

pmoura avatar pmoura commented on August 23, 2024

It seems that a restart is needed after setting the compatibility mode. Odd. I don't remember doing it after I found the workaround.

from gprolog.

pmoura avatar pmoura commented on August 23, 2024

Fix confirmed using the Windows build you provided at http://www.gprolog.org/unstable/ Thanks!

from gprolog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.