def get_resource_from_path(path):
 resource = False
 for adpath in ad_paths:
  adpath = os.path.join(adpath, '')
  if (os.path.commonprefix([adpath, path]) == adpath):
   resource = path.replace(adpath, '', 1)
   break
 if resource:
  relative = resource.split(os.path.sep)
  if (not relative[0]):
   relative.pop(0)
  module = relative.pop(0)
  return (module, '/'.join(relative), os.path.sep.join(relative))
 return None

def get_resource_from_path ( path ) : resource = False for adpath in ad_paths : adpath = os . path . join ( adpath , '' ) if ( os . path . commonprefix ( [ adpath , path ] ) == adpath ) : resource = path . replace ( adpath , '' , 1 ) break if resource : relative = resource . split ( os . path . sep ) if ( not relative [ 0 ] ) : relative . pop ( 0 ) module = relative . pop ( 0 ) return ( module , '/' . join ( relative ) , os . path . sep . join ( relative ) ) return None
tries to extract the module name and the resources relative path out of an absolute resource path .