From fb14fa89101205bf5e51a475e638238d5ac29f69 Mon Sep 17 00:00:00 2001 From: Dean Jackson Date: Mon, 4 Dec 2017 23:27:08 +0100 Subject: [PATCH] Don't trust `syncfolder` setting #8 --- ...alfredworkflow => Fixum-0.8.alfredworkflow | Bin 109475 -> 109732 bytes src/fixum.py | 47 ++++++-- src/info.plist | 104 +++++++++--------- 3 files changed, 88 insertions(+), 63 deletions(-) rename Fixum-0.7.alfredworkflow => Fixum-0.8.alfredworkflow (91%) diff --git a/Fixum-0.7.alfredworkflow b/Fixum-0.8.alfredworkflow similarity index 91% rename from Fixum-0.7.alfredworkflow rename to Fixum-0.8.alfredworkflow index 0397cf07b181bd937d22a6910bb3fe0ff83dedd3..729487b8711f985e94f5a04fa1a35f090c70d192 100644 GIT binary patch delta 5927 zcmZXYXEYpa(D!#&U1hPX7QKsALl8ZBi(VqSW!2~*v8)iiTe5l=Z6k=@64ASm=q*Gi zA>2x|CwJ~I@B2KT=J)@fnK{?FzRZ~^o*^umBTSaXQ?BGrQ8@TFycY&Kz##Ljue67Q zw%Y|M0DwzDOaUzodWhR1VVK*(Kadmv#Qz5f0N~RA0DxS^g{KQ@r@1zwx|GRUTz6gO zmp+xp`a858Rj=bWPQq>J$+#ih(=<^VWP+qFr`~7Ur*`Nno4T!$gzmWgdJr`39&#+_ zGU3J5*ZR$`ekrgiAKq!)Aq%wy{BbI*3ePak?^o^_{j@c@*2m1Ts)4P`N2N35X6@bg z=stprp!W7}IJOnu!?Yub>+B0Ct??Dxc&BtO=Dj=E*+oN$pWBUnD10X^y?zx}ZJTLQ z<&wyj^Nasum5cx*X%?ko65XRb^u6ad&}Z%HNi3yvRvqkSI2s0l^M-^kf}UP@}Kc08UKl74A_)Lw6Y2de5KxEqUBqZ+)=U4_qIg`=#ofTt9S#?a+# zG!&%F&uqPhk5{}}-L$3hbmrIBX3`6TAo`1^?Gn|l_Bmf%V{ z$KKZ;8?5HM$5DE-P@1YA_n_i*goa{e@0Rn_Ss}t>dgExu;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=`Qo0h9<{1sMQ#Rid>RKotFg#Nft)3T;dN~zk%>w|BQpQUP;bp;HpAyAE_qFXyx?b&j+6D)HvnqWqCKc=5 z9DEqTzGa&AV>zMj^PdhIL>gvlUyC&vV65tjB7-p4vBL3%=RK8}kqIn2ikI$lGLzd1 z=C^WqUZ0poB7`Nm46aFqgg~|G-Cg$J&DDesj`1~VvR{AfXfM(ZExrTiHrJf$rSEl) z8eV_C~cq9P$!$mcIn zK`EAj@6)}@iS!AUJtCkdOldZUJQ`*KF|1^GQ{3L+!IU9ETz(N9l!P5~Z^ZCTy5Hd3 z|CzRXk>oo@#6mtUGpS{yT!?SMlBH$PV0-ii<0DA6vu`uTKbHo=vrsolkr(Ye&9ksi zlksE|xF^cqa`SUHPh#8XbM*KpnO7%~0ijZU7d|6e^=hZqp|sdpEOqS0DjQ9#dcP}O z%C7Mc<)ZxmYQSaDX$Z#DBx8NE1d8AviBws{`703iI+p(cO6L?8W8^E_M{1g1< z2#mi1F=%D|Z|1eGgOE-jWs1Qhh*N8^|3WtM|3dZt_AdASkzXED_y38mpxv0iqPYeS zTtV0MkK! zGb1+&z&rx~`=mfYAjn;Pc@IQ!*I|M{cWox9AQ+P$1afe-b>n&I?BMxI_c;`F_Za=% zJ1wG7l$hZEM$1HyVTE8#h_5&jT?p2P@F*i;#b8Dxya=oXA=CcP^cI0tA+P@#Cy1Nz ze=xiF?z0use+I!|j)SBu0ZT*NE&l`6R)omdzhL=4fZQtqD`I3=fe;_98IcC1U}=n_ zI|H*JN7mmNh?pJnq!erjsdPtbm4WpzLI4mVC+GpPtL!f6c@KHdDa!An%#=vO ka`1DA2PLwm9IOLTdW?it+-==00clnNeu~wd_xCUS5C2hq=Kufz diff --git a/src/fixum.py b/src/fixum.py index fbd4aca..bd6960a 100755 --- a/src/fixum.py +++ b/src/fixum.py @@ -90,7 +90,10 @@ def touch(path): def read_plist(path): """Convert plist to XML and read its contents.""" - cmd = [b'plutil', b'-convert', b'xml1', b'-o', b'-', path] + if isinstance(path, unicode): + path = path.encode('utf-8') + + cmd = ['plutil', '-convert', 'xml1', '-o', '-', path] xml = subprocess.check_output(cmd) return plistlib.readPlistFromString(xml) @@ -146,18 +149,40 @@ def get_workflow_info(dirpath): def get_workflow_directory(): """Return path to Alfred's workflow directory.""" + # It appears that `syncfolder` may be set but not used + # https://github.com/deanishe/alfred-fixum/issues/8 + # So don't trust `syncfolder` and fall back to the default + # location, and if that fails, the grandparent of the working + # directory. + candidates = [] + + # User-specified sync directory prefs = read_plist(ALFRED_PREFS) - syncdir = prefs.get('syncfolder', '~/Library/Application Support/Alfred 3') + syncdir = prefs.get('syncfolder') + if syncdir: + candidates.append(syncdir) + + # Default location + candidates.append('~/Library/Application Support/Alfred 3') + + # Workflows are run with their own directory as the working path, + # so try grandparent as last resort (if workflow is being run + # from Alfred) + if os.getenv('alfred_version'): + candidates.append( + os.path.dirname(os.path.dirname(os.path.abspath(os.curdir)))) + else: + log.warning('workflow is not being run from Alfred') - syncdir = os.path.expanduser(syncdir) - wf_dir = os.path.join(syncdir, 'Alfred.alfredpreferences/workflows') - # log.debug('Workflow sync dir : %r', wf_dir) + candidates = [os.path.expanduser(p) for p in candidates] - if os.path.exists(wf_dir): - # log.debug('Workflow directory retrieved from Alfred preferences') - return wf_dir + for path in candidates: + log.debug('looking for workflows in %r ...', path) + wf_dir = os.path.join(path, 'Alfred.alfredpreferences/workflows') + if os.path.exists(wf_dir): + return wf_dir - log.debug('Alfred.alfredpreferences/workflows not found') + log.debug('workflow directory not found') return None @@ -264,7 +289,7 @@ def main(wf): dry_run = opts['--nothing'] log.info('=' * 50) log.debug('opts=%r', opts) - log.info('looking for workflows using an outdated (buggy) version ' + log.info('looking for workflows using an outdated version ' 'of Alfred-Workflow...') # subprocess.call(['open', '-a', 'Console', wf.logfile]) @@ -275,7 +300,7 @@ def main(wf): print('ERROR: could not find workflow directory') return 1 - log.info('workflow directory: %s', root) + log.info('workflow directory: %r', root) blacklisted = load_blacklist() diff --git a/src/info.plist b/src/info.plist index 38da786..f249d46 100644 --- a/src/info.plist +++ b/src/info.plist @@ -48,23 +48,44 @@ config - lastpathcomponent - - onlyshowifquerypopulated - - removeextension + concurrently - text - {query} - title - Fixum + escaping + 102 + script + mode=$1 +datadir="$alfred_workflow_data" +cachedir="$alfred_workflow_cache" +blacklist="${datadir}/blacklist.txt" +logfile="${cachedir}/net.deanishe.alfred.fixum.log" + +# create data & cache directories, logfile and blacklist +test -d "$cachedir" || mkdir -p "$cachedir" +test -f "$logfile" || touch "$logfile" + +test -d "$datadir" || mkdir -p "$datadir" +test -f "$blacklist" || cp blacklist.default.txt "$blacklist" + +# script actions +[[ "$mode" = dryrun ]] && /usr/bin/python fixum.py --nothing +[[ "$mode" = fix ]] && /usr/bin/python fixum.py +[[ "$mode" = blacklist ]] && open "$blacklist" +[[ "$mode" = log ]] && open -a Console "$logfile" + +exit 0 + scriptargtype + 1 + scriptfile + + type + 5 type - alfred.workflow.output.notification + alfred.workflow.action.script uid - 90302262-60E4-4C1C-AAEA-2A5C3F4C025A + 97033D94-9B6F-446C-94E5-AB677B5ABB4F version - 1 + 2 config @@ -116,44 +137,23 @@ config - concurrently + lastpathcomponent - escaping - 102 - script - mode=$1 -datadir="$alfred_workflow_data" -cachedir="$alfred_workflow_cache" -blacklist="${datadir}/blacklist.txt" -logfile="${cachedir}/net.deanishe.alfred.fixum.log" - -# create data & cache directories, logfile and blacklist -test -d "$cachedir" || mkdir -p "$cachedir" -test -f "$logfile" || touch "$logfile" - -test -d "$datadir" || mkdir -p "$datadir" -test -f "$blacklist" || cp blacklist.default.txt "$blacklist" - -# script actions -[[ "$mode" = dryrun ]] && /usr/bin/python fixum.py --nothing -[[ "$mode" = fix ]] && /usr/bin/python fixum.py -[[ "$mode" = blacklist ]] && open "$blacklist" -[[ "$mode" = log ]] && open -a Console "$logfile" - -exit 0 - scriptargtype - 1 - scriptfile - - type - 5 + onlyshowifquerypopulated + + removeextension + + text + {query} + title + Fixum type - alfred.workflow.action.script + alfred.workflow.output.notification uid - 97033D94-9B6F-446C-94E5-AB677B5ABB4F + 90302262-60E4-4C1C-AAEA-2A5C3F4C025A version - 2 + 1 readme @@ -165,27 +165,27 @@ It is primarily a workaround to fix bugs that are preventing the workflows from 4FFEB019-EBD2-452B-AC8B-54E7C33ABE9F xpos - 20 + 40 ypos - 30 + 40 90302262-60E4-4C1C-AAEA-2A5C3F4C025A xpos - 370 + 390 ypos - 30 + 40 97033D94-9B6F-446C-94E5-AB677B5ABB4F xpos - 200 + 220 ypos - 30 + 40 version - 0.7 + 0.8 webaddress