@@ -62,7 +62,8 @@ def initializeProfile(self, directory: QDir, settings: mobase.ProfileSetting):
6262 def _on_mod_installed (self , mod : mobase .IModInterface ):
6363 mod_name = mod .name ()
6464 self ._organizer .onNextRefresh (
65- lambda : self ._apply_version (self ._organizer .modList ().getMod (mod_name )), True
65+ lambda : self ._apply_version (self ._organizer .modList ().getMod (mod_name )),
66+ True ,
6667 )
6768
6869 def _apply_version (self , mod : mobase .IModInterface | None ):
@@ -77,13 +78,22 @@ def _apply_version(self, mod: mobase.IModInterface | None):
7778 version = version .lstrip ("v" )
7879 meta_ini = mod_path / "meta.ini"
7980 raw = meta_ini .read_bytes ()
80- raw = re .sub (rb"^\s*version\s*=\s*[^\r\n]*" , f"version={ version } " .encode (), raw , flags = re .MULTILINE )
81+ raw = re .sub (
82+ rb"^\s*version\s*=\s*[^\r\n]*" ,
83+ f"version={ version } " .encode (),
84+ raw ,
85+ flags = re .MULTILINE ,
86+ )
8187 meta_ini .write_bytes (raw )
82- qInfo (f"Set version of { mod_path .name } to { version } using { json_file .name } " )
88+ qInfo (
89+ f"Set version of { mod_path .name } to { version } using { json_file .name } "
90+ )
8391 self ._organizer .modDataChanged (mod )
8492 break
8593 except (json .JSONDecodeError , OSError ) as e :
86- qWarning (f"Failed to apply version for { mod_path .name } via { json_file .name } : { e } " )
94+ qWarning (
95+ f"Failed to apply version for { mod_path .name } via { json_file .name } : { e } "
96+ )
8797 continue
8898
8999 def savesDirectory (self ) -> QDir :
0 commit comments