Skip to content

Commit

Permalink
Replace hard-wired by environment-induced paths.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikipore committed Jun 21, 2016
1 parent 937d8c9 commit 81ea35b
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions alfred.py
Expand Up @@ -61,6 +61,9 @@ def config():
def decode(s):
return unicodedata.normalize('NFD', s.decode('utf-8'))

def env(key):
return os.environ['alfred_%s' % key]

def uid(uid):
return u'-'.join(map(str, (bundleid, uid)))

Expand All @@ -71,10 +74,10 @@ def unescape(query, characters=None):

def work(volatile):
path = {
True: '~/Library/Caches/com.runningwithcrayons.Alfred-3/Workflow Data',
False: '~/Library/Application Support/Alfred 3/Workflow Data'
True: env('workflow_cache'),
False: env('workflow_data')
}[bool(volatile)]
return _create(os.path.join(os.path.expanduser(path), bundleid))
return _create(path)

def write(text):
sys.stdout.write(text)
Expand Down

0 comments on commit 81ea35b

Please sign in to comment.