Possible bug with Edit Spy predicates window with 8.1.9

See https://github.com/SWI-Prolog/swipl-devel/blob/4c52acabaeac29ac0457894a7631da370fcf56c8/src/pl-nt.c#L856

1 Like

With regards to win_folder/2 on my laptop this is what results.

?- win_folder(P,M).
P = common_altstartup,
M = 'C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Startup' ;
P = altstartup,
M = 'C:/Users/Eric/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup' ;
P = appdata,
M = 'C:/Users/Eric/AppData/Roaming' ;
Thread 1 (main): foreign predicate system:win_folder/2 did not clear exception: 
        error(system_error,context(system:win_folder/2,The operation completed successfully.
))
P = cookies,
M = 'C:/Users/Eric/AppData/Local/Microsoft/Windows/INetCookies' ;
P = desktop,
M = 'C:/Users/Eric/Desktop' ;
P = common_desktopdirectory,
M = 'C:/Users/Public/Desktop' ;
P = desktopdirectory,
M = 'C:/Users/Eric/Desktop' ;
P = common_favorites,
M = 'C:/Users/Eric/Favorites' ;
P = favorites,
M = 'C:/Users/Eric/Favorites' ;
P = fonts,
M = 'C:/WINDOWS/Fonts' ;
P = history,
M = 'C:/Users/Eric/AppData/Local/Microsoft/Windows/History' ;
P = internet_cache,
M = 'C:/Users/Eric/AppData/Local/Microsoft/Windows/INetCache' ;
Thread 1 (main): foreign predicate system:win_folder/2 did not clear exception: 
        error(system_error,context(system:win_folder/2,The operation completed successfully.
))
P = personal,
M = 'C:/Users/Eric/Documents' ;
Thread 1 (main): foreign predicate system:win_folder/2 did not clear exception: 
        error(system_error,context(system:win_folder/2,The operation completed successfully.
))
P = nethood,
M = 'C:/Users/Eric/AppData/Roaming/Microsoft/Windows/Network Shortcuts' ;
P = personal,
M = 'C:/Users/Eric/Documents' ;
Thread 1 (main): foreign predicate system:win_folder/2 did not clear exception: 
        error(system_error,context(system:win_folder/2,The operation completed successfully.
))
P = printhood,
M = 'C:/Users/Eric/AppData/Roaming/Microsoft/Windows/Printer Shortcuts' ;
P = common_programs,
M = 'C:/ProgramData/Microsoft/Windows/Start Menu/Programs' ;
P = programs,
M = 'C:/Users/Eric/AppData/Roaming/Microsoft/Windows/Start Menu/Programs' ;
P = recent,
M = 'C:/Users/Eric/AppData/Roaming/Microsoft/Windows/Recent' ;
Thread 1 (main): foreign predicate system:win_folder/2 did not clear exception: 
        error(system_error,context(system:win_folder/2,The operation completed successfully.
))
P = sendto,
M = 'C:/Users/Eric/AppData/Roaming/Microsoft/Windows/SendTo' ;
P = common_startmenu,
M = 'C:/ProgramData/Microsoft/Windows/Start Menu' ;
P = startmenu,
M = 'C:/Users/Eric/AppData/Roaming/Microsoft/Windows/Start Menu' ;
P = common_startup,
M = 'C:/ProgramData/Microsoft/Windows/Start Menu/Programs/Startup' ;
P = startup,
M = 'C:/Users/Eric/AppData/Roaming/Microsoft/Windows/Start Menu/Programs/Startup' ;
P = templates,
M = 'C:/Users/Eric/AppData/Roaming/Microsoft/Windows/Templates' ;
false.
?- win_folder(appdata,M).
M = 'C:/Users/Eric/AppData/Roaming'.

Here is partial listing of the directories in the folder returned by

win_folder(appdata,M).
Microsoft Windows [Version 10.0.17134.885]
(c) 2018 Microsoft Corporation. All rights reserved.

C:\Users\Eric>cd AppData\Roaming

C:\Users\Eric\AppData\Roaming>dir

 Directory of C:\Users\Eric\AppData\Roaming

06/13/2019  09:42 AM    <DIR>          .
06/13/2019  09:42 AM    <DIR>          ..
11/16/2017  04:23 PM    <DIR>          .minecraft
12/17/2017  06:08 PM    <DIR>          A Good Snowman Is Hard To Build
01/01/2016  12:58 PM    <DIR>          Adobe
12/06/2017  03:14 PM    <DIR>          Braid
07/19/2019  12:01 PM    <DIR>          Code
05/12/2019  06:42 PM    <DIR>          discord
08/23/2018  09:18 AM    <DIR>          Docker
01/09/2016  11:30 AM    <DIR>          DockerToolbox
05/28/2019  10:30 AM    <DIR>          FontForge
11/08/2017  06:55 AM    <DIR>          Google
05/29/2018  12:20 PM    <DIR>          great-permutator
10/14/2015  06:12 PM    <DIR>          Hex-Rays
04/24/2018  01:15 PM    <DIR>          Human Resource Machine
02/16/2016  07:28 PM    <DIR>          ICSharpCode
02/18/2018  11:01 AM    <DIR>          inkscape
09/15/2015  05:23 PM    <DIR>          Intel Corporation
04/02/2019  08:55 AM    <DIR>          JetBrains
01/24/2016  12:46 PM    <DIR>          jupyter
01/18/2016  06:40 PM    <DIR>          LibreOffice
09/19/2015  10:43 PM    <DIR>          Macromedia
06/29/2016  12:19 PM    <DIR>          Microsoft Corporation
12/23/2015  10:44 AM    <DIR>          Microsoft FxCop
07/30/2018  10:56 AM    <DIR>          Microsoft Visual Studio
02/19/2018  08:54 AM    <DIR>          MiKTeX
12/22/2017  01:50 PM    <DIR>          Mozilla
04/17/2019  10:32 AM    <DIR>          Neo4j Desktop
03/31/2019  01:07 PM    <DIR>          Notepad++
10/05/2016  06:39 PM    <DIR>          npm
06/04/2019  11:57 AM    <DIR>          npm-cache
05/12/2016  09:41 AM    <DIR>          NuGet
11/14/2015  04:17 PM    <DIR>          NVIDIA
11/14/2015  04:52 PM    <DIR>          NVIDIA Corporation
01/05/2016  04:30 PM    <DIR>          PowerShell Tools for Visual Studio
02/21/2016  09:49 AM    <DIR>          RLogs
01/26/2018  01:16 PM    <DIR>          scope
06/21/2017  09:54 PM    <DIR>          Skype
10/28/2015  12:34 PM    <DIR>          Stella
08/09/2016  12:58 PM    <DIR>          Sublime Text 3
11/02/2015  04:18 PM    <DIR>          Subversion
11/29/2015  04:32 PM    <DIR>          Sun
04/26/2018  06:55 AM    <DIR>          SWI-Prolog
10/09/2017  04:22 PM    <DIR>          Unity
10/24/2018  12:12 PM    <DIR>          Visual Studio Code
12/21/2018  01:05 PM    <DIR>          Visual Studio Setup
12/14/2018  01:48 PM    <DIR>          VisualVM
11/29/2015  09:00 AM    <DIR>          VMware
06/13/2017  08:38 AM    <DIR>          vstelemetry
07/09/2016  08:24 PM    <DIR>          Wolfram Research
07/09/2016  05:56 PM    <DIR>          WolframCDFPlayer
05/13/2019  12:39 PM    <DIR>          xm1
07/02/2016  07:15 AM    <DIR>          xpce
11/10/2017  08:52 AM    <DIR>          Zoom
               0 File(s)              0 bytes
              63 Dir(s)  74,869,743,616 bytes free

C:\Users\Eric\AppData\Roaming>

I was caught off guard when I saw SWI-Prolog and xpce in the list. I didn’t know SWI-Prolog was using this directory already.

1 Like

Pushed a fix for that. Only happens in mode(-,?), so not very likely to cause problems.

?- listing(file_search_path, [source(true)]).
...
% From /home/jan/src/swipl-devel/linux/home/boot/toplevel.pl:59
user:file_search_path(app_data, PrologAppData) :-
    (   current_prolog_flag(windows, true)
    ->  catch(win_folder(appdata, AppData), _, fail),
        atom_concat(AppData, '/SWI-Prolog', PrologAppData),
        (   exists_directory(PrologAppData)
        ->  true
        ;   catch(make_directory(PrologAppData), _, fail)
        )
    ;   catch(expand_file_name('~/lib/swipl', [PrologAppData]), _, fail)
    ).
user:file_search_path(app_preferences, Preferences) :-
    (   current_prolog_flag(windows, true)
    ->  Preferences = app_data('.')
    ;   catch(expand_file_name(~, [UserHome]), _, fail)
    ->  Preferences = UserHome
    ).
user:file_search_path(user_profile, app_preferences('.')).
...

The option source(true) is quite helpful to find the actual definition of multifile predicates and where the clauses come from/

1 Like