
    i                     l    S r SSKJr  SSKJr  SSKJr  SSKrSSKJr  SSKJ	r	  S r
S	 rS
 r  SS jrg)zCSome general file utilities used that can be used by the Cloud SDK.    )absolute_import)division)unicode_literalsN)encoding)	platformsc                  L    [         R                  " [        R                  S5      $ )z5Returns properly encoded system PATH variable string.PATH)encoding_utilGetEncodedValueosenviron     R/var/www/html/banglarbhumi/venv/lib/python3.13/site-packages/fire/console/files.py_GetSystemPathr      s    		&	&rzz6	::r   c                    [        U[        5      (       a  [        SR                  U5      5      eU H  nUR	                  [
        R                  5       H  nUR                  S5      n[
        R                  R                  [
        R                  R                  X@5      U-   5      n[
        R                  R                  U5      (       d  My  [
        R                  " U[
        R                  5      (       d  M  Us  s  $    M     g)ai  Internal function to a find an executable.

Args:
  executable: The name of the executable to find.
  path: A list of directories to search separated by 'os.pathsep'.
  pathext: An iterable of file name extensions to use.

Returns:
  str, the path to a file on `path` with name `executable` + `p` for
    `p` in `pathext`.

Raises:
  ValueError: invalid input.
zr_FindExecutableOnPath(..., pathext='{0}') failed because pathext must be an iterable of strings, but got a string."N)
isinstancestr
ValueErrorformatsplitr   pathsepstrippathnormpathjoinisfileaccessX_OK)
executabler   pathextext	directoryfulls         r   _FindExecutableOnPathr&   !   s      
 !!'2 2
 cZZ

+	//#&iWWbggll9ACGHd			"))D"''":": ,  
r   c                 B    U [         R                  R                  :X  a  gg)N)z.exez.cmdz.batz.comz.ps1) z.sh)r   OperatingSystemWINDOWS)platforms    r   _PlatformExecutableExtensionsr,   B   s    **2223r   c                    U(       dA  [         R                  R                  U 5      S   (       a  [        SR	                  U 5      5      e[         R                  R                  U 5      (       a  [        SR	                  U 5      5      eUc  [        5       nOUnUb  UO&[        [        R                  R                  5       5      n[        XU5      $ )a  Searches for `executable` in the directories listed in `path` or $PATH.

Executable must not contain a directory or an extension.

Args:
  executable: The name of the executable to find.
  path: A list of directories to search separated by 'os.pathsep'.  If None
    then the system PATH is used.
  pathext: An iterable of file name extensions to use.  If None then
    platform specific extensions are used.
  allow_extensions: A boolean flag indicating whether extensions in the
    executable are allowed.

Returns:
  The path of 'executable' (possibly with a platform-specific extension) if
  found and executable, None if not found.

Raises:
  ValueError: if executable has a path or an extension, and extensions are
    not allowed, or if there's an internal error.
   zWFindExecutableOnPath({0},...) failed because first argument must not have an extension.zQFindExecutableOnPath({0},...) failed because first argument must not have a path.)r   r   splitextr   r   dirnamer   r,   r   r)   Currentr&   )r!   r   r"   allow_extensionseffective_patheffective_pathexts         r   FindExecutableOnPathr5   I   s    0 
bgg..z:1=
 <<BF:<NP P WW__Z  
 66<fZ6HJ J 
\#%NN")"5w9$44<<>@  
z0
2 2r   )NNF)__doc__
__future__r   r   r   r   fire.consoler   r
   r   r   r&   r,   r5   r   r   r   <module>r9      s:     J &  ' 	 2 ";
B 9=*/)2r   