def getLocalPath(source_link): storage_dir = os.path.join(core._storage_base_dir, core.bundleID()) if not os.path.exists(storage_dir): os.makedirs(storage_dir) _, ext = os.path.splitext(source_link) filename = '{}{}'.format(util.hashDigest(source_link), ext) return os.path.join(storage_dir, filename)
def bundleID(): global _bundle_id if _bundle_id: return _bundle_id try: plist_path = os.path.abspath('./info.plist') pref = plistlib.readPlist(plist_path) _bundle_id = pref.get('bundleid', '') name = pref.get('name', '') if not _bundle_id and name: name_hash = util.hashDigest(name) _bundle_id = 'com.alfredapp.workflow.{}'.format(name_hash) except: pass if not _bundle_id: _bundle_id = 'com.alfredapp.workflow.BoudleIDMissing' return _bundle_id
def getLocalPath(source_link): if not os.path.exists(_storage_dir): os.makedirs(_storage_dir) _, ext = os.path.splitext(source_link) filename = '{}{}'.format(util.hashDigest(source_link), ext) return os.path.join(_storage_dir, filename)
def _getFilepath(name): if not os.path.exists(_cache_dir): os.makedirs(_cache_dir) # convert to md5, more safe for file name return os.path.join(_cache_dir, '{}.json'.format(util.hashDigest(name)))
def _getFilepath(name): cache_dir = os.path.join(core._cache_base_dir, core.bundleID()) if not os.path.exists(cache_dir): os.makedirs(cache_dir) # convert to md5, more safe for file name return os.path.join(cache_dir, '{}.json'.format(util.hashDigest(name)))