hydrus/include/ClientFiles.py

40 lines
901 B
Python
Raw Normal View History

2015-03-18 21:46:29 +00:00
import gc
2017-11-08 22:07:12 +00:00
import HydrusExceptions
import HydrusGlobals as HG
2015-06-24 22:10:14 +00:00
import os
2015-03-18 21:46:29 +00:00
def GetAllPaths( raw_paths ):
file_paths = []
paths_to_process = raw_paths
while len( paths_to_process ) > 0:
next_paths_to_process = []
for path in paths_to_process:
2017-11-08 22:07:12 +00:00
if HG.view_shutdown:
raise HydrusExceptions.ShutdownException()
2015-03-18 21:46:29 +00:00
if os.path.isdir( path ):
2015-11-04 22:30:28 +00:00
subpaths = [ os.path.join( path, filename ) for filename in os.listdir( path ) ]
2015-03-18 21:46:29 +00:00
next_paths_to_process.extend( subpaths )
2015-11-04 22:30:28 +00:00
else:
file_paths.append( path )
2015-03-18 21:46:29 +00:00
paths_to_process = next_paths_to_process
return file_paths
2015-12-02 22:32:18 +00:00