
    b_
                         d dl Z e j                  d    dk\  Zerd Znd Z	 d dlmZ y# e$ r$ d dlZej                  ej                  z  dfdZY yw xY w)    N   c                     | S N ss    (lib/python3.12/site-packages/xdg/util.pyur
      s        c                 $    | j                  d      S )Nzutf-8)decoder   s    r	   r
   r
   
   s    xx  r   )whichc                 b    d }t         j                  j                         r | |      r S y|xs. t         j                  j	                  dt         j
                        j                  t         j                        }t        j                  dk(  rt         j                  |vr |j                  dt         j                         t         j                  j	                  dd      j                  t         j                        }t         fd|D              r g}n|D cg c]  } |z   	 }}n g}t               }|D ]m  }t         j                  j                  |      }	|	|vs'|j                  |	       |D ]1  }
t         j                  j!                  ||
      } |||      s-|c c S  o yc c}w )	aK  Given 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.

        c                     t         j                  j                  |       xr8 t        j                  | |      xr  t         j                  j	                  |        S r   )ospathexistsaccessisdir)fnmodes     r	   _access_checkzwhich.<locals>._access_check    sA    GGNN2& .299R+> .GGMM"--/r   NPATHwin32r   PATHEXT c              3   x   K   | ]1  }j                         j                  |j                                3 y wr   )lowerendswith).0extcmds     r	   	<genexpr>zwhich.<locals>.<genexpr>9   s)     H399;''		4s   7:)r   r   dirnameenvirongetdefpathsplitpathsepsysplatformcurdirinsertanysetnormcaseaddjoin)r"   r   r   r   pathextfilesr!   seendirnormdirthefilenames   `           r	   r   r      sN   	/ 77??3S$'
:

vrzz:AA"**M<<7"99$Aryy) jjnnY399"**EG
 HHH.56gssg6 EEuCgg&&s+Gd?!$G77<<W5D$T40#  %	   7s   F,)
r*   version_infoPY3r
   shutilr   ImportErrorr   F_OKX_OKr   r   r	   <module>r@      s[    
	qQ!> ;"'') 8;s   ( &AA