+
    Ki|  c                   sL    ^ RI t ^ RIt^ RIHt ^ RIHt R tR tR tR t	R t
R# )	i    N)system)loggerc                s   \         P                  P                  V R4      p\         P                  P                  V4      '       g   \        P
                  ! RV 4       R# \         P                  ! V4      p\        V4      ^8  d   \        P
                  ! R4       \         P                  P                  W^ ,          4      # )z6Return the absolute path where a GOG game is installedzdrive_c/GOG Games/zNo 'GOG Games' folder in %sNz5More than 1 game found, this is currently unsupported)ospathjoinexistsr   warninglistdirZlen)target_pathgog_game_pathZgamess   &  4/usr/lib/python3.14/site-packages/lutris/util/gog.pyget_gog_game_pathr      sy    GGLL.BCM77>>-((4kBJJ}%E
5zA~NO77<<Qx00    c                s   \         P                  ! V 4       Uu. uF6  qP                  R4      '       g   K  VP                  R4      '       g   K4  VNK8  	  ppV'       g   \        P
                  ! RV 4       R# \         P                  P                  W^ ,          4      p\        VRR7      ;_uu_ 4       p\        P                  ! VP                  4       4      pRRR4       V# u upi   + '       g   i     X# ; i)zCExtract runtime information such as executable paths from GOG filesZgoggamez.infozNo config file found in %sNzutf-8)Zencoding)r   r   
startswithZendswithr   Zerrorr   r   ZopenjsonZloadsZread)r	   ZfnZconfig_filenameZgog_config_pathZgog_config_file
gog_configs   &     r
   get_gog_configr      s    $&JJ}$=s$=byAYr^`^i^ijq^rrr$=Os1=Aggll=!2DEO	o	0	0OZZ 4 4 67
 
1 t
 
1	0s   C"C"C"3%C''C8	c                 s,  a V3R  lp/ pRV 9  d   R# V! V R,          4      VR&   V P                  R4      '       d   V! V R,          4      VR&   V P                  R4      '       d   V R,          VR&   V P                  R4      '       d   V R,          VR&   V# )	c                s  < \         P                  ! \        P                  P	                  SV 4      4      p\        P                  P                  V4      '       d   V# V P                  RR4      pVP                  R4      '       d
   VR,          p\         P                  ! \        P                  P	                  SV4      4      p\        P                  P                  V4      '       d   V# \        P                  ! RV 4       V # )zGOG's paths are relative to the gog_game_path, not relative to each other,
so we resolve them all to absolute paths and fix casing issues. If required,
we'll replace backslashes with slashes.Z\Z/:i   NNz1GOG configuration path '%s' could not be resolved)
r    Zfix_path_caser   r   r   r   Zreplacer   r   r   )r   ZresolvedZfixedr	   s   &  r
   resolve_pathZ%get_game_config.<locals>.resolve_path!   s     '']D(IJ77>>(##OT3'C  "IE'']E(JK77>>(##OJDQr   r   NZexeZ
workingDirZworking_dirZ	argumentsZargsZname)get)taskr	   r   configs   &f  r
   get_game_configr       s    $ FT f.F5Mxx ,T,-? @}xxk*vxxfvMr   c                 s    V R ,          pR. /pV FZ  p\        WA4      pV'       g   K  VP                  R4      '       d   VP                  V4       KB  VR,          P                  V4       K\  	  V# )Z	playTasksZlaunch_configsZ	isPrimary)r   r   ZupdateZappend)r   r	   Z
play_tasksZlutris_configr   r   s   &&    r
   convert_gog_config_to_lutrisr   A   si    K(J%r*M 588K    (*+226:  r   c                sB    \        V 4      pV'       d   \        V4      # R# )z,Return the GOG configuration for a root pathN)r   r   )r   r	   s   & r
   get_gog_config_from_pathr   O   s    %k2Mm,, r   )r   r   Zlutris.utilr    Zlutris.util.logr   r   r   r   r   r   ) r   r
   <module>r      s+     	  "	1	B-r   