ref: File.recursiveFiles
This commit is contained in:
13
brew.py
13
brew.py
@@ -1920,9 +1920,7 @@ class InstallQueue:
|
||||
class Fixer:
|
||||
@staticmethod
|
||||
def run(path: str) -> None:
|
||||
for base, dirs, files in os.walk(path):
|
||||
for file in files:
|
||||
fname = os.path.join(base, file)
|
||||
for fname in File.recursiveFiles(path):
|
||||
if os.path.islink(fname):
|
||||
Fixer.symlink(fname)
|
||||
continue
|
||||
@@ -2698,6 +2696,15 @@ class File:
|
||||
with open(fname, 'a'):
|
||||
os.utime(fname, None)
|
||||
|
||||
@staticmethod
|
||||
def recursiveFiles(path: str) -> Iterator[str]:
|
||||
''' yield only files from `os.walk(path)` '''
|
||||
if os.path.isdir(path):
|
||||
for base, _, files in os.walk(path):
|
||||
for file in files:
|
||||
if file != '.DS_Store':
|
||||
yield os.path.join(base, file)
|
||||
|
||||
@staticmethod
|
||||
def folderSize(path: str) -> tuple[int, int]:
|
||||
'''Calculate total size of folder and all it's content (recursively)'''
|
||||
|
||||
Reference in New Issue
Block a user