File tree Expand file tree Collapse file tree 1 file changed +14
-4
lines changed
Expand file tree Collapse file tree 1 file changed +14
-4
lines changed Original file line number Diff line number Diff line change 22import re
33
44# Paths
5- base_dir = os .path .dirname (os .path .abspath (__file__ ))
6- labs_dir = os .path .join (base_dir , 'labs' )
7- readme_path = os .path .join (base_dir , 'README.md' )
5+ base_dir = os .path .dirname (os .path .abspath (__file__ )) # /scripts
6+ repo_root = os .path .abspath (os .path .join (base_dir , ".." )) # repo root
7+ labs_dir = os .path .join (repo_root , 'labs' )
8+ readme_path = os .path .join (repo_root , 'README.md' )
9+
10+ # 0. Safety checks
11+ if not os .path .exists (readme_path ):
12+ print (f"README not found at { readme_path } , skipping cleanup." )
13+ exit (0 )
14+
15+ if not os .path .exists (labs_dir ):
16+ print (f"Labs directory not found at { labs_dir } , skipping cleanup." )
17+ exit (0 )
818
919# 1. Remove files named "tmp" or "tnp" with no extension
10- for root , dirs , files in os .walk (base_dir ):
20+ for root , dirs , files in os .walk (repo_root ):
1121 for file in files :
1222 if file in ('tmp' , 'tnp' ):
1323 file_path = os .path .join (root , file )
You can’t perform that action at this time.
0 commit comments