void Instance::InsertMod(size_t index, const wxFileName &source) { wxFileName dest(Path::Combine(GetInstModsDir().GetFullPath(), source.GetFullName())); if (!source.SameAs(dest)) { wxCopyFile(source.GetFullPath(), dest.GetFullPath()); } dest.MakeRelativeTo(); SetNeedsRebuild(); int oldIndex = Find(modList.begin(), modList.end(), [&dest] (Mod mod) -> bool { return mod.GetFileName().SameAs(dest); }); if (oldIndex != -1) { modList.erase(modList.begin() + oldIndex); } if (index >= modList.size()) modList.push_back(Mod(dest)); else modList.insert(modList.begin() + index, Mod(dest)); SaveModList(); }
/******************************* * Callbacks *******************************/ void Core_SaveCallback(void * reserved) { SaveModList(&g_OBSESerializationInterface); g_StringMap.Save(&g_OBSESerializationInterface); g_ArrayMap.Save(&g_OBSESerializationInterface); SaveGlobals (&g_OBSESerializationInterface); }
void Instance::DeleteMod(size_t index) { Mod *mod = &modList[index]; if (wxRemoveFile(mod->GetFileName().GetFullPath())) { SetNeedsRebuild(); modList.erase(modList.begin() + index); SaveModList(); } else { wxLogError(_("Failed to delete mod.")); } }
void Instance::UpdateModList() { LoadModList(); SaveModList(); }
void Core_SaveCallback(const F4SESerializationInterface * intfc) { SaveModList(intfc); }