All pastes #298064 Raw Edit

Untitled

public python v1 · immutable
#298064 ·published 2006-12-31 15:00 UTC
rendered paste body
def pathdata(entries, path):   """(entries,path)   Returns the data(dict) for a specific file/dir at the path specified."""   mysplit=string.split(path,"/")   myentries=entries   mytarget=mysplit[-1]   mysplit=mysplit[:-1]   for mys in mysplit:      if myentries["dirs"].has_key(mys):         myentries=myentries["dirs"][mys]      else:         return None   if myentries["dirs"].has_key(mytarget):      return myentries["dirs"][mytarget]   elif myentries["files"].has_key(mytarget):      return myentries["files"][mytarget]   else:      return None