A small menubar app that allows you to switch between R versions quickly (if you have multiple versions of R framework installed). https://rud.is/rswitch
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

35 lines
905 B

5 years ago
//
// HandleUpdate.swift
// RSwitch
//
// Created by hrbrmstr on 8/24/19.
// Copyright © 2019 Bob Rudis. All rights reserved.
//
import Foundation
import Cocoa
extension AppDelegate {
@objc func checkForUpdate(_ sender: NSMenuItem?) {
let url = URL(string: app_urls.version_check)
do {
URLCache.shared.removeAllCachedResponses()
var version = try String.init(contentsOf: url!)
version = version.trimmingCharacters(in: .whitespacesAndNewlines)
if (version.isVersion(greaterThan: Bundle.main.releaseVersionNumber!)) {
let url = URL(string: app_urls.releases)
NSWorkspace.shared.open(url!)
} else {
self.notifyUser(title: "RSwitch", text: "You are running the latest version of RSwitch.")
}
} catch {
self.notifyUser(title: "Action failed", subtitle: "Update check", text: "Error: \(error)")
}
}
}