コード例 #1
0
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)
コード例 #2
0
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)
コード例 #3
0
ファイル: core.py プロジェクト: 00zl00/AlfredWorkflow.com
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
コード例 #4
0
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
コード例 #5
0
ファイル: storage.py プロジェクト: 00zl00/AlfredWorkflow.com
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)
コード例 #6
0
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)))
コード例 #7
0
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)))
コード例 #8
0
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)
コード例 #9
0
ファイル: cache.py プロジェクト: 00zl00/AlfredWorkflow.com
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)))