Example #1
0
        private static bool TryDelete(ModList list)
        {
            var path = FilePath(list);

            if (!File.Exists(path))
            {
                Log.Error($"Tried to delete {path}, but it does not exist");
                return(false);
            }

            try
            {
                File.Delete(path);
                Notify_ModListsChanged();
                Messages.Message(I18n.ModListDeleted(list.Name), MessageTypeDefOf.TaskCompletion, false);
                return(true);
            }
            catch (Exception e)
            {
                Log.Error(e.Message);
                return(false);
            }
        }