From c20ce2dcd7fdcfddfedd25e8b3f63cf888d51981 Mon Sep 17 00:00:00 2001
From: Antonio MATTAR <antonio.mattar@etu.univ-amu.fr>
Date: Tue, 28 Jun 2022 11:03:33 +0200
Subject: [PATCH] -Added the feature of directly deleting the temp file after
 using it.

---
 main.py | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)

diff --git a/main.py b/main.py
index c6bb82c..3e7a36d 100644
--- a/main.py
+++ b/main.py
@@ -95,8 +95,10 @@ def run_beta_reduction_totale(terme,path='beta_reduction_totale'):
     if save_image_choice == 'y':
         os.makedirs("./sauvegarde/"+path, exist_ok=True)
         moveImages(path,'./sauvegarde/'+path)
+        os.rmdir(path)
     elif save_image_choice == 'n':
         delete_images(path)
+        os.rmdir(path)
 
 def run_beta_reduction_interactive_totale(terme,path='beta_reduction_interactive_totale'):
     terme = parsing.parseTerm(terme)
@@ -110,8 +112,10 @@ def run_beta_reduction_interactive_totale(terme,path='beta_reduction_interactive
     if save_image_choice == 'y':
         os.makedirs("./sauvegarde/"+path, exist_ok=True)
         moveImages(path,'./sauvegarde/'+path)
+        os.rmdir(path)
     elif save_image_choice == 'n':
         delete_images(path)
+        os.rmdir(path)
 
 def run_show_numbers(path):
     os.makedirs(path, exist_ok=True)
@@ -133,8 +137,10 @@ def run_show_numbers(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
 
     elif choice==2:
         clear()
@@ -149,8 +155,10 @@ def run_show_numbers(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
     elif choice==3:
         run_main_menu()
 
@@ -173,8 +181,10 @@ def run_boolean_expression(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
     elif choice==2:
         clear()
         t = app_functions.AND
@@ -186,8 +196,10 @@ def run_boolean_expression(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
     elif choice==3:
         clear()
         t = app_functions.OR
@@ -199,8 +211,10 @@ def run_boolean_expression(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
     elif choice ==4:
         clear()
         t = app_functions.XOR
@@ -212,8 +226,10 @@ def run_boolean_expression(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
 
     elif choice==5:
         clear()
@@ -226,8 +242,10 @@ def run_boolean_expression(path):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
     elif choice==6:
         run_main_menu()
 
@@ -298,8 +316,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice == 2:
         clear()
@@ -311,8 +331,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice == 3:
         clear()
@@ -324,8 +346,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice==4:
         clear()
@@ -337,8 +361,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice==5:
         clear()
@@ -350,8 +376,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice==6:
         clear()
@@ -363,8 +391,10 @@ def run_arithmetic_operations_menu(path='arithmetic expressions'):
         if save_image_choice == 'y':
             os.makedirs("./sauvegarde/"+path, exist_ok=True)
             moveImages(path,'./sauvegarde/'+path)
+            os.rmdir(path)
         elif save_image_choice == 'n':
             delete_images(path)
+            os.rmdir(path)
         return_main_menu()
     elif choice == 7:
         clear()
-- 
GitLab