//TODO save location data on install // delete location data on remove // destingish between public and private modules private static void InitInstalledModule(Module m) { bool remove = false; if (Helper.ClassWithNamespaceExists(m.location_data.classname)) { m.path = GetModuleDirectory(m); if (string.IsNullOrEmpty(m.path) == false) { m.installed_module = Parser.ParseToObject <ModuleInfo>(FileHelper.ReadFileIntoString(FindModuleFilePath(m.path))); string calced_guid = AssetDatabase.AssetPathToGUID(m.path); if (m.location_data.guid != calced_guid) { SaveModuleLocationData(m, calced_guid); } } else { remove = true; } } if (remove) { FileHelper.RemoveValueFromFile(m.id, PATH.MODULES_LOCATION__DATA); m.location_data = null; } }
public static void RemoveModule(Module module) { module.is_being_installed_or_removed = true; FileHelper.RemoveValueFromFile(module.id, PATH.MODULES_LOCATION__DATA); foreach (Action f in pre_module_remove_functions) { f.Invoke(); } TrashHandler.MoveDirectoryToTrash(module.path); AssetDatabase.Refresh(); }