-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRCC.py
63 lines (52 loc) · 2.3 KB
/
RCC.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import os
import shutil
import tkinter as tk
from tkinter import ttk
from threading import Thread
import psutil
def is_roblox_running():
for process in psutil.process_iter(['pid', 'name']):
if "RobloxPlayerBeta.exe" in process.info['name']:
return True
return False
def cache_clean(progress_var, status_label):
try:
if is_roblox_running():
status_label.config(text="Please close Roblox before clearing cache.")
return
# Cache Paths so that it's organized
cache_paths = [
os.path.join(os.getenv("LOCALAPPDATA"), "Roblox", "logs"),
os.path.join(os.getenv("temp"), "Roblox"),
]
total_directories = len(cache_paths)
deleted_at_least_one_directory = False
for index, cache_path in enumerate(cache_paths):
try:
if os.path.exists(cache_path):
cache_name = os.path.basename(cache_path)
# Delete folder so it's faster (It doesn't break roblox, don't worry.)
shutil.rmtree(cache_path)
progress_value = (index + 1) / total_directories * 100
progress_var.set(progress_value)
status_label.config(text=f"Deleted {cache_name}")
deleted_at_least_one_directory = True
else:
# Patch here because cache_name don't work for some reason
status_label.config(text=f"No cache for {os.path.basename(cache_path)}")
except Exception as e:
status_label.config(text=f"Error deleting {cache_path}: {e}")
if deleted_at_least_one_directory:
status_label.config(text="Roblox Cache Cleaned!")
except Exception as e:
status_label.config(text=f"Error: {e}")
root = tk.Tk()
root.title("Roblox Cache Cleaner")
delete_button = tk.Button(root, text="Clear Cache", command=lambda: Thread(target=cache_clean, args=(progress_var, status_label),).start(),)
progress_var = tk.DoubleVar()
progress_bar = ttk.Progressbar(root, variable=progress_var, length=290, mode="determinate")
status_label = tk.Label(root, text="")
delete_button.pack(pady=10)
progress_bar.pack(pady=10)
status_label.pack()
root.mainloop()