Skip to content

Commit

Permalink
clean_cache_files
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSPoon committed Dec 29, 2024
1 parent ef88945 commit cd6ff49
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion libraries/lsp_server_metta/prolog/lsp_metta_workspace.pl
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@
retractall(lsp_state:made_metta_file_buffer(Path)),
retractall(lsp_cache:gave_document_symbols(Path,_)),
%metta_file_buffer(0,_Ord,_Kind, _Term, _NamedVarsList, Path, _Pos)
symbol_concat(Path, '.buffer~', BufferFile),
cache_file(Path, '.buffer~', BufferFile),
if_t(exists_file(BufferFile),delete_file(BufferFile)),
retractall(user:metta_file_buffer(_Lvl,_Ord,_Kind, _Term, _NamedVarsList, Path, _Pos)))),!.

Expand Down
7 changes: 4 additions & 3 deletions prolog/metta_lang/metta_loader.pl
Original file line number Diff line number Diff line change
Expand Up @@ -1877,13 +1877,13 @@
( exists_directory(Dir)
-> directory_files(Dir, Items),
forall(member(Item, Items),
( Item \= '.', Item \= '..',
ignore(( Item \= '.', Item \= '..',
directory_file_path(Dir, Item, FilePath),
( (exists_file(FilePath), atom_concat(_,Ending, FilePath))
-> delete_file(FilePath)
; true
)
))
)))
; true
).

Expand All @@ -1906,7 +1906,8 @@
-> TempDir = 'C:/Windows/Temp'
; TempDir = '/tmp'
)),
atomic_list_concat([TempDir, '/metta_cache/'], Dir).
absolute_file_name(TempDir,TDir,[access(write),file_type(directory)]),!,
directory_file_path(TDir,'metta_cache',Dir).

%! fr_slashes(+Pairs, +In, -Out) is det.
%
Expand Down
6 changes: 3 additions & 3 deletions prolog/metta_lang/metta_parser.pl
Original file line number Diff line number Diff line change
Expand Up @@ -862,7 +862,7 @@
:- dynamic ok_to_stop/1.

process_expressions(FileName,_InStream, _OutStream) :- atomic(FileName), fail,
symbol_concat(FileName, '.buffer~', BufferFile),
cache_file(FileName, BufferFile),
exists_file(BufferFile),
use_cache_file(FileName, BufferFile),
ensure_loaded(BufferFile), !.
Expand All @@ -877,8 +877,8 @@
assertz(ok_to_stop(FileName, false)),

% Start a thread to report progress every 30 seconds
get_time(StartTime), % Record the start time
thread_create(report_file_progress(FileName, InStream, TotalLines, StartTime), _, [detached(true)]),
% get_time(StartTime), % Record the start time
% thread_create(report_file_progress(FileName, InStream, TotalLines, StartTime), _, [detached(true)]),

ignore(stream_property(InStream, file_name(Stem))), % Get the file name of the stream.
ignore(Stem = FileName), % Assign the input file name if no stream file name.
Expand Down

0 comments on commit cd6ff49

Please sign in to comment.