Browse Source

precise version

tags/v1.5.0
boB Rudis 1 year ago
parent
commit
365c1d14fa
No known key found for this signature in database GPG Key ID: 1D7529BE14E2BBA9
3 changed files with 41 additions and 4 deletions
  1. +2
    -2
      RSwitch.xcodeproj/project.pbxproj
  2. +1
    -1
      RSwitch/Base.lproj/Main.storyboard
  3. +38
    -1
      RSwitch/Swift/Utils/RVersions.swift

+ 2
- 2
RSwitch.xcodeproj/project.pbxproj View File

@ -502,7 +502,7 @@
"$(PROJECT_DIR)/RSwitch/ObjC/ProcInfo",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = is.rud.bob.RSwitch;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
@ -535,7 +535,7 @@
"$(PROJECT_DIR)/RSwitch/ObjC/ProcInfo",
);
MACOSX_DEPLOYMENT_TARGET = 10.14;
MARKETING_VERSION = 1.4.1;
MARKETING_VERSION = 1.4.2;
PRODUCT_BUNDLE_IDENTIFIER = is.rud.bob.RSwitch;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";


+ 1
- 1
RSwitch/Base.lproj/Main.storyboard View File

@ -741,7 +741,7 @@
<attributedString key="textStorage">
<fragment>
<string key="content">
RSwitch v1.4.1
RSwitch v1.4.2
Copyright © 2019 Bob Rudis


+ 38
- 1
RSwitch/Swift/Utils/RVersions.swift View File

@ -18,6 +18,8 @@ class RVersions {
static let macos_r_framework = "/Library/Frameworks/R.framework/Versions" // Where the official R installs go
static let replRegex = try!NSRegularExpression(pattern: "[[:alpha:][:space:]\"#_]+", options: NSRegularExpression.Options.caseInsensitive)
static func currentVersionTarget() -> String {
// get where Current points to
@ -36,6 +38,41 @@ class RVersions {
}
static func preciseVersion(versionPath : String) -> String {
let actualPath = (versionPath.starts(with: "/") ? "" : RVersions.macos_r_framework + "/" ) +
versionPath + "/Headers/Rversion.h"
var out = ""
if (FileManager.default.fileExists(atPath:actualPath)) {
do {
let versionHeader = (try NSString(contentsOfFile: actualPath, encoding: String.Encoding.utf8.rawValue)) as String
let majMin = versionHeader
.split(separator: "\n")
.filter{
$0.contains("R_MAJOR") || $0.contains("R_MINOR")
}
.map{
replRegex.stringByReplacingMatches(in: String($0),
options: [],
range: NSMakeRange(0, $0.count),
withTemplate: "")
}
out = " (" + majMin[0] + "." + majMin[1] + ")"
} catch {
}
}
return(out)
}
static func hasRBinary(versionPath : String) -> Bool {
return(
FileManager.default.fileExists(
@ -70,7 +107,7 @@ class RVersions {
let complete = RVersions.hasRBinary(versionPath: version)
let keynum = (i < 10) ? String(i) : ""
let item = NSMenuItem(
title: complete ? version : version + " (incomplete)",
title: complete ? version + RVersions.preciseVersion(versionPath: version) : version + " (incomplete)",
action: complete ? handler : nil,
keyEquivalent: complete ? keynum : ""
)


Loading…
Cancel
Save