o )X @srddlZejddkZerddZnddZz ddlmZWdSey8ddlZejej BdfddZYdSw) NcCs|SNsrr*/usr/lib/python3/dist-packages/xdg/util.pyusrcCs |dS)Nzutf-8)decoderrrrr s )whichc sdd}tjr||rSdS|ptjdtjtj}tj dkrVtj |vr2| dtj tjddtj}t fd d |DrLg}n fd d |D}ng}t }|D](}tj|}||vr|||D]} tj|| } || |r| Sqqq^dS) aKGiven a command, mode, and a PATH string, return the path which conforms to the given mode on the PATH, or None if there is no such file. `mode` defaults to os.F_OK | os.X_OK. `path` defaults to the result of os.environ.get("PATH"), or can be overridden with a custom search path. cSs&tj|ot||otj| Sr)ospathexistsaccessisdir)fnmoderrr _access_check s zwhich.._access_checkNPATHwin32rPATHEXTc3s"|] }|VqdSr)lowerendswith.0extcmdrr 9s zwhich..csg|]}|qSrrrrrr <szwhich..)r r dirnameenvirongetdefpathsplitpathsepsysplatformcurdirinsertanysetnormcaseaddjoin) rrr rpathextfilesseendirnormdirthefilenamerrrr s4        r ) r& version_infoPY3rshutilr ImportErrorr F_OKX_OKrrrrs