Commit b43ac9a04afc5e72141bf8466a81fa66d9a38b5f

Authored by David RENÉ
1 parent b26fda29

[-] fix the delete out of state. Don't try to delete file "." and ".." which are…

… undeletable directories
Showing 1 changed file with 25 additions and 20 deletions   Show diff stats
web/making_a_web_site.anubis
@@ -2638,26 +2638,31 @@ define (String state_name) -> PreviousState($State) @@ -2638,26 +2638,31 @@ define (String state_name) -> PreviousState($State)
2638 per states life time period). 2638 per states life time period).
2639 2639
2640 define (List(String) file_names) -> One 2640 define (List(String) file_names) -> One
2641 - make_delete_out_of_date_states_function  
2642 - (  
2643 - Maybe($State) dummy,  
2644 - String state_directory  
2645 - ) =  
2646 - (List(String) file_names) |-df->  
2647 - if file_names is  
2648 - {  
2649 - [ ] then unique,  
2650 - [h . t] then  
2651 - with file_path = state_directory+"/"+h,  
2652 - if (RetrieveResult((Int,$State)))retrieve(file_path) is ok(d)  
2653 - then (  
2654 - if d is (time_stamp,data) then  
2655 - if time_stamp < now  
2656 - then (forget(remove(file_path)); df(t))  
2657 - else df(t)  
2658 - )  
2659 - else (forget(remove(file_path)); df(t))  
2660 - }. 2641 + make_delete_out_of_date_states_function
  2642 + (
  2643 + Maybe($State) dummy,
  2644 + String state_directory
  2645 + )=
  2646 + (List(String) file_names) |-df->
  2647 + if file_names is
  2648 + {
  2649 + [ ] then unique,
  2650 + [h . t] then
  2651 + //we can't delete the "." and ".." file. So go to next file in the list
  2652 + if h = "." | h = ".." then
  2653 + df(t)
  2654 + else
  2655 + with file_path = state_directory+"/"+h,
  2656 + if (RetrieveResult((Int,$State)))retrieve(file_path) is ok(d)
  2657 + then (
  2658 + if d is (time_stamp,data) then
  2659 + if time_stamp < now
  2660 + then (forget(remove(file_path)); df(t))
  2661 + else df(t)
  2662 + )
  2663 + else (forget(remove(file_path)); df(t))
  2664 + }
  2665 +.
2661 2666
2662 2667
2663 The 'labelled arrow' |-df-> is documented in 'documentation/en/anubis_doc.txt'. 2668 The 'labelled arrow' |-df-> is documented in 'documentation/en/anubis_doc.txt'.