def IsPathInSubdirectories(filename, subdirectories, normcase=os.path.normcase):
 file_dir = normcase(os.path.dirname(os.path.abspath(filename)))
 for parent in subdirectories:
  fixed_parent = normcase(os.path.abspath(parent))
  if (os.path.commonprefix([file_dir, fixed_parent]) == fixed_parent):
   return True
 return False

def IsPathInSubdirectories ( filename , subdirectories , normcase = os . path . normcase ) : file_dir = normcase ( os . path . dirname ( os . path . abspath ( filename ) ) ) for parent in subdirectories : fixed_parent = normcase ( os . path . abspath ( parent ) ) if ( os . path . commonprefix ( [ file_dir , fixed_parent ] ) == fixed_parent ) : return True return False
determines if a filename is contained within one of a set of directories .