
    Iif                        S r SSKJr  SSKrSSKrSSKJr  SSKJr   SSK	r	\" \5      R                  5       R                  R                  rSrSS jrSS jrSS	 jrSS
 jrSS jrSSS jjrg! \
 a    SSKr	 NYf = f)z;Helpers for resolving configuration paths across platforms.    )annotationsN)Path)Any
PlayPalacec                 N    [         R                  " 5       R                  5       S:H  $ )z&Return True when executing on Windows.windows)platformsystemlower     7c:\Users\dbart\PlayPalace11\server\core\config_paths.py_running_on_windowsr      s    ??""$	11r   c                     [         S-  R                  5       (       a  [         $ [        5       (       a8  [        R                  R                  S5      n U (       a  [        U 5      [        -  $ [         $ )aw  Return the default directory that should contain config.toml.

When running from a source checkout (config.example.toml present next to
the package) the module directory is used on every platform so that a
developer's ``server/config.toml`` is always found.  The Windows
ProgramData path is only used for an installed application where the
example template has been removed.
config.example.tomlPROGRAMDATA)_MODULE_DIRexistsr   osenvirongetr   _WINDOWS_APP_DIR)program_datas    r   get_default_config_dirr      sT     	++3355zz~~m4%(888r   c                     [        5       S-  $ )zAReturn the default config.toml location for the current platform.zconfig.toml)r   r   r   r   get_default_config_pathr   *   s    !#m33r   c                     [         S-  $ )z8Return the path to the repository's config example file.r   )r   r   r   r   get_example_config_pathr   /   s    ...r   c                 :    [        5       n U R                  SSS9  U $ )z9Create the default config directory if it does not exist.T)parentsexist_ok)r   mkdir)
target_dirs    r   ensure_default_config_dirr$   4   s#    ')JTD1r   c                    U c
  [        5       n [        U 5      n U R                  5       (       d  0 $ U R                  S5       n[        R
                  " U5      sSSS5        $ ! , (       d  f       g= f)z3Load the full config.toml contents as a dictionary.Nrb)r   r   r   opentomllibload)pathfhs     r   load_full_configr,   ;   sK    |&(:D;;==		4B||B 
s   A!!
A/)returnbool)r-   r   )N)r*   zstr | Path | Noner-   zdict[str, Any])__doc__
__future__r   r   r	   pathlibr   typingr   r(   ModuleNotFoundErrortomli__file__resolveparentr   r   r   r   r   r   r$   r,   r   r   r   <module>r8      sx    A " 	    8n$$&--44 2
$4
/
 _  s   A/ /
A<;A<