-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
49 lines (32 loc) · 1.37 KB
/
main.py
File metadata and controls
49 lines (32 loc) · 1.37 KB
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
from modules.cleaner import clean_browser_cache, clean_temporary_files, clean_trash
from pathlib import Path
# Caminhos utilizados na função clean_trash
PATH_TRASH_BASE = Path('~/.local/share/Trash/').expanduser().resolve()
# Caminhos utilizados na função clean_browser_cache
CHROME_CACHE_TARGETS = [
'~/.config/google-chrome/Default/GPUCache',
'~/.config/google-chrome/Default/Service Worker',
'~/.config/google-chrome/Default/IndexedDB',
]
"""
Utiliza as funções expanduser().resolve para transformar
os caminhos relativos em absolutos
"""
# Caminhos absolutos
path_temp_absolute = Path('/tmp/').resolve() # O /tmp/ não precisa do expanduser por já ser um caminho absoluto.
# Conversão para caminhos absolutos utilizados na função clean_browser_cache
CHROME_CACHE_PATHS = [
Path(p).expanduser().resolve()
for p in CHROME_CACHE_TARGETS
]
path_browser_cache_firefox_profilecache_absolute = Path('~/.cache/mozilla/firefox/').expanduser().resolve()
# função principal
def main():
print("\n Inicializando Linux Deep Cleaner CLI...\n")
# Chamada das funções
clean_trash(PATH_TRASH_BASE / 'files', PATH_TRASH_BASE / 'info')
clean_browser_cache(CHROME_CACHE_PATHS, path_browser_cache_firefox_profilecache_absolute)
clean_temporary_files(path_temp_absolute)
print("\nLimpeza concluída!")
if __name__ == "__main__":
main()