+
    Ki  c                   s    R t ^ RIt^ RIt^ RIHt ^ RIHt ^ RIHt ^ RI	H
t
 ^ RIHtHt . ROt ! R R4      tR	 tR
 tR tR# )zSteam appmanifest file handlingN)logger)get_steamapps_dirs)	vdf_parse)slugify)fix_path_casepath_existsc                   s   a  ] tR t^&t o RtR tR t]R 4       t]R 4       t	]R 4       t
]R 4       t]R 4       t]R	 4       tR
 tR tR tRtV tR# )AppManifestz0Representation of an AppManifest file from Steamc                s   Wn         \        P                  P                  V4      w  V n        p\
        P                  ! R V4      R,          V n        / V n        \        V4      '       d3   \        VRRR7      ;_uu_ 4       p\        V/ 4      V n        RRR4       R# \        P                  ! RV4       R#   + '       g   i     R# ; i)z(\d+)Zrzutf-8)ZencodingNz)Path to AppManifest file %s doesn't exist)appmanifest_pathospathZsplitsteamapps_pathreZfindallsteamidappmanifest_datar   Zopenr   r    Zerror)selfr   ZfilenameZappmanifest_files   &&  B/usr/lib/python3.14/site-packages/lutris/util/steam/appmanifest.py__init__ZAppManifest.__init__)   s     0(*6F(G%Xzz(H5b9 "'((&g>>BR(12BB(G% ?> LLDFVW ?>>s   ?B44C	c                s(    R V P                   ,          # )z<AppManifest: %s>)r   r      &r   __repr__ZAppManifest.__repr__5   s    "T%:%:::    c                L    V P                   P                  R4      ;'       g    / # )z;State of the app (dictionary containing game specific info)ZAppState)r   getr   r   r   	app_stateZAppManifest.app_state8   s#     $$((4:::r   c                r   )z"Return the user configuration partZ
UserConfigr   r   r   r   r   user_configZAppManifest.user_config=   s!     ~~!!,/5525r   c                s    V P                   P                  R4      pV'       g   V P                  P                  R4      pV# )z=Return the game name from either the state or the user configname)r   r   r   )r   Z_name   & r   r   ZAppManifest.nameB   s6     ""6*$$((0Er   c                s,    \        V P                  4      # )z&Return a slugified version of the name)r   r   r   r   r   slugZAppManifest.slugJ   s     tyy!!r   c                s8    V P                   P                  R4      # )z Path where the game is installed
installdirr   r   r   r   r   ZAppManifest.installdirO   s     ~~!!,//r   c                s    . pV P                   P                  R^ 4      p\        \        V4      4      R^R1,          p\	        V4       F1  w  r4VR8X  g   K  VP                  \        V^,           ,          4       K3  	  V# )z"Return the states of a Steam game.Z
StateFlagsNZ1r   )r   r   ZbinZintZ	enumerateZappendAPP_STATE_FLAGS)r   statesZstate_flagsZindexZflags   &    r   r    ZAppManifest.statesT   sm     nn((q9#k*+EQrE2$[1KEs{oeai89 2 r   c                s     RV P                   9   # )z#True if the game is fully installedFully Installed)r    r   r   r   is_installedZAppManifest.is_installed_   s     DKK//r   c                s    V P                   '       g   R# \        \        P                  P	                  V P
                  RV P                   4      4      pV'       d   \        V4      '       d   V# R# )z+Absolute path of the installation directoryNZcommon)r   r   r	   r
   joinr   r   )r   Zinstall_pathr   r   get_install_pathZAppManifest.get_install_pathc   sL    $RWW\\$2E2ExQUQ`Q`%abK55r   c                s    \        4       pV P                  VR,          9   d   R# V P                  VR,          9   d   R# \        RV P                  : RV: 24      h)z)Platform the game uses (linux or windows)ZlinuxZwindowszCan't find z in )r   r   
ValueError)r   Zsteamapps_pathsr   r   get_platformZAppManifest.get_platforml   sL    ,./'"::/)"<<$2E2EWXXr   )r   r   r   r   N)Z__name__Z
__module__Z__qualname__Z__firstlineno____doc__r   r   Zpropertyr   r   r   r   r   r    r"   r$   r&   Z__static_attributes__Z__classdictcell__)Z__classdict__s   @r   r   r   &   s     :
X; ; ; 6 6   " " 0 0  0Y Yr   r   c                s   V '       g   \        R4      h\        V 4      '       g   \        R4      hV'       g   \        R4      h\        P                  P                  V RV,          4      p\        V4      '       g   R# \        V4      # )zIGiven the steam apps path and appid, return the corresponding appmanifestzsteamapps_path is mandatoryz(steamapps_path must be a valid directoryzMissing mandatory appidzappmanifest_%s.acfN)r%   r   ZIOErrorr	   r
   r#   r   )r   appidr      && r   get_appmanifest_from_appidr*   v   sm    677~&&@AA233ww||N4H54PQ'(('((r   c                sL    \        W4      pV'       g   R# VP                  4       # )z0Return the path where a Steam game is installed.N)r*   r$   )r   r(   Zappmanifestr)   r   get_path_from_appmanifestr+      s!    ,^CK''))r   c                s    \         P                  ! V 4       Uu. uF$  p\        P                  ! RV4      '       g   K"  VNK&  	  up# u upi )zCReturn the list for all appmanifest files in a Steam library folderz^appmanifest_\d+.acf$)r	   Zlistdirr   Zmatch)r   Zfr   r   get_appmanifestsr,      s6    zz.1[1!RXX>VXY5ZAA1[[[s
   AA)ZInvalidZUninstalledzUpdate Requiredr!   Z	EncryptedZLockedzFiles MissingZ
AppRunningzFiles CorruptzUpdate RunningzUpdate PausedzUpdate StartedZUninstallingzBackup RunningZReconfiguringZ
ValidatingzAdding FilesZPreallocatingZDownloadingZStagingZ
CommittingzUpdate Stopping)r'   r	   r   Zlutris.util.logr    Zlutris.util.steam.configr   Zlutris.util.steam.vdfutilsr   Zlutris.util.stringsr   Zlutris.util.systemr   r   r   r   r*   r+   r,   ) r   r   <module>r-      sC    % 	 	 " 7 0 ' 94MY MY`)*\r   