Skip to content

Commit a4b38ee

Browse files
committed
Release 2.1.25
Added support for new formats and an experimental Shortcut Action.
1 parent 7718ad5 commit a4b38ee

File tree

543 files changed

+35627
-12350
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

543 files changed

+35627
-12350
lines changed

Application/AboutViewController.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//
77

88
import Cocoa
9-
import WebKit
9+
@preconcurrency import WebKit
1010

1111
class AboutViewController: NSViewController, WKNavigationDelegate {
1212
@IBOutlet weak var imageView: NSImageView!

Application/AppDelegate.swift

+50-2
Original file line numberDiff line numberDiff line change
@@ -255,11 +255,16 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
255255
}
256256
}
257257

258+
public lazy var CLIURL: URL = {
259+
return URL(fileURLWithPath: utsname.isAppleSilicon ? "/opt/sbarex/syntax_highlight_cli" : "/usr/local/bin/syntax_highlight_cli");
260+
}()
261+
258262
@IBAction func installCLITool(_ sender: Any) {
259263
guard let srcApp = Bundle.main.url(forResource: "syntax_highlight_cli", withExtension: nil) else {
260264
return
261265
}
262-
let dstApp = URL(fileURLWithPath: "/usr/local/bin/syntax_highlight_cli")
266+
267+
let dstApp = CLIURL;
263268

264269
let alert1 = NSAlert()
265270
alert1.messageText = "The tool will be installed in \(dstApp.path) \nDo you want to continue?"
@@ -270,6 +275,24 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
270275
guard alert1.runModal() == .alertFirstButtonReturn else {
271276
return
272277
}
278+
279+
/*if !FileManager.default.fileExists(atPath: dstApp.deletingLastPathComponent().path) {
280+
do {
281+
var error: NSDictionary?
282+
NSAppleScript(source: "do shell script \"sudo mkdir -p \(dstApp.deletingLastPathComponent().path)\" with administrator " + "privileges")!.executeAndReturnError(&error)
283+
guard error == nil else {
284+
throw MyShellError.runtimeError(error!.description)
285+
}
286+
} catch {
287+
let alert = NSAlert()
288+
alert.messageText = "Unable to install the command line tool"
289+
alert.informativeText = "(\(error.localizedDescription))\n\nYou can manually install the tool from a Terminal shell with this command: \nln -sfv \"\(srcApp.path)\" \"\(dstApp.path)\""
290+
alert.alertStyle = .critical
291+
alert.runModal()
292+
return
293+
}
294+
}*/
295+
273296
guard access(dstApp.deletingLastPathComponent().path, W_OK) == 0 else {
274297
let alert = NSAlert()
275298
alert.messageText = "Unable to install the tool: \(dstApp.deletingLastPathComponent().path) is not writable"
@@ -282,6 +305,13 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
282305

283306
let alert = NSAlert()
284307
do {
308+
if FileManager.default.fileExists(atPath: dstApp.deletingLastPathComponent().path) {
309+
var error: NSDictionary?
310+
NSAppleScript(source: "do shell script \"sudo mkdir1 -p \(dstApp.deletingLastPathComponent().path)\" with administrator privileges")!.executeAndReturnError(&error)
311+
guard error == nil else {
312+
throw MyShellError.runtimeError(error!.description)
313+
}
314+
}
285315
try FileManager.default.createSymbolicLink(at: dstApp, withDestinationURL: srcApp)
286316
alert.messageText = "Command line tool installed"
287317
alert.informativeText = "You can call it from this path: \(dstApp.path)"
@@ -295,7 +325,7 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
295325
}
296326

297327
@IBAction func revealCLITool(_ sender: Any) {
298-
let u = URL(fileURLWithPath: "/usr/local/bin/syntax_highlight_cli")
328+
let u = CLIURL
299329
if FileManager.default.fileExists(atPath: u.path) {
300330
// Open the Finder to the settings file.
301331
NSWorkspace.shared.activateFileViewerSelecting([u])
@@ -314,3 +344,21 @@ class AppDelegate: NSObject, NSApplicationDelegate, NSMenuItemValidation {
314344
}
315345
}
316346

347+
extension utsname {
348+
static var sMachine: String {
349+
var utsname = utsname()
350+
uname(&utsname)
351+
return withUnsafePointer(to: &utsname.machine) {
352+
$0.withMemoryRebound(to: CChar.self, capacity: Int(_SYS_NAMELEN)) {
353+
String(cString: $0)
354+
}
355+
}
356+
}
357+
static var isAppleSilicon: Bool {
358+
sMachine == "arm64"
359+
}
360+
}
361+
362+
fileprivate enum MyShellError: Error {
363+
case runtimeError(String)
364+
}

Application/Info.plist

+93-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<key>LSMinimumSystemVersion</key>
3434
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
3535
<key>NSHumanReadableCopyright</key>
36-
<string>Developed by SBAREX (2019-2024).</string>
36+
<string>Developed by SBAREX (2019-2025).</string>
3737
<key>NSMainStoryboardFile</key>
3838
<string>Storyboard</string>
3939
<key>NSPrincipalClass</key>
@@ -140,6 +140,23 @@
140140
</array>
141141
</dict>
142142
</dict>
143+
<dict>
144+
<key>UTTypeConformsTo</key>
145+
<array>
146+
<string>public.c-plus-plus-source</string>
147+
<string>public.source-code</string>
148+
<string>dyn.ah62d4rv4ge80g7k</string>
149+
</array>
150+
<key>UTTypeIdentifier</key>
151+
<string>com.nvidia.cuda</string>
152+
<key>UTTypeTagSpecification</key>
153+
<dict>
154+
<key>public.filename-extension</key>
155+
<array>
156+
<string>cu</string>
157+
</array>
158+
</dict>
159+
</dict>
143160
<dict>
144161
<key>UTTypeConformsTo</key>
145162
<array>
@@ -1147,6 +1164,24 @@
11471164
</array>
11481165
</dict>
11491166
</dict>
1167+
<dict>
1168+
<key>UTTypeDescription</key>
1169+
<string>Jupyter Notebook</string>
1170+
<key>UTTypeConformsTo</key>
1171+
<array>
1172+
<string>public.json</string>
1173+
<string>dyn.ah62d4rv4ge80w6d3r3va</string>
1174+
</array>
1175+
<key>UTTypeIdentifier</key>
1176+
<string>org.jupyter.ipynb</string>
1177+
<key>UTTypeTagSpecification</key>
1178+
<dict>
1179+
<key>public.filename-extension</key>
1180+
<array>
1181+
<string>ipynb</string>
1182+
</array>
1183+
</dict>
1184+
</dict>
11501185
<dict>
11511186
<key>UTTypeConformsTo</key>
11521187
<array>
@@ -1181,6 +1216,24 @@
11811216
</array>
11821217
</dict>
11831218
</dict>
1219+
<dict>
1220+
<key>UTTypeConformsTo</key>
1221+
<array>
1222+
<string>dyn.ah62d4rv4ge8007a</string>
1223+
</array>
1224+
<key>UTTypeDescription</key>
1225+
<string>Kotlin Source File</string>
1226+
<key>UTTypeIdentifier</key>
1227+
<string>org.kotlinlang.kotlin-source</string>
1228+
<key>UTTypeTagSpecification</key>
1229+
<dict>
1230+
<key>public.filename-extension</key>
1231+
<array>
1232+
<string>kts</string>
1233+
<string>kt</string>
1234+
</array>
1235+
</dict>
1236+
</dict>
11841237
<dict>
11851238
<key>UTTypeConformsTo</key>
11861239
<array>
@@ -1255,6 +1308,24 @@
12551308
</array>
12561309
</dict>
12571310
</dict>
1311+
<dict>
1312+
<key>UTTypeDescription</key>
1313+
<string>MAMEdev layout file</string>
1314+
<key>UTTypeConformsTo</key>
1315+
<array>
1316+
<string>public.xml</string>
1317+
<string>dyn.ah62d4rv4ge8022p3</string>
1318+
</array>
1319+
<key>UTTypeIdentifier</key>
1320+
<string>org.mamedev.lay</string>
1321+
<key>UTTypeTagSpecification</key>
1322+
<dict>
1323+
<key>public.filename-extension</key>
1324+
<array>
1325+
<string>lay</string>
1326+
</array>
1327+
</dict>
1328+
</dict>
12581329
<dict>
12591330
<key>UTTypeConformsTo</key>
12601331
<array>
@@ -1505,6 +1576,11 @@
15051576
<key>public.filename-extension</key>
15061577
<array>
15071578
<string>scm</string>
1579+
<string>ss</string>
1580+
<string>sls</string>
1581+
<string>sps</string>
1582+
<string>sld</string>
1583+
<string>sch</string>
15081584
</array>
15091585
</dict>
15101586
</dict>
@@ -1743,6 +1819,22 @@
17431819
</array>
17441820
</dict>
17451821
</dict>
1822+
<dict>
1823+
<key>UTTypeConformsTo</key>
1824+
<array>
1825+
<string>public.plain-text</string>
1826+
<string>dyn.ah62d4rv4ge81e2prru</string>
1827+
</array>
1828+
<key>UTTypeIdentifier</key>
1829+
<string>org.raml.raml</string>
1830+
<key>UTTypeTagSpecification</key>
1831+
<dict>
1832+
<key>public.filename-extension</key>
1833+
<array>
1834+
<string>raml</string>
1835+
</array>
1836+
</dict>
1837+
</dict>
17461838
<dict>
17471839
<key>UTTypeConformsTo</key>
17481840
<array>

Application/PreviewView.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class PreviewView: NSView, SettingsSplitViewElement {
6262
@IBOutlet weak var textView: NSTextView!
6363

6464
var isLocked = false
65-
fileprivate (set) var isRefreshig = false
65+
fileprivate(set) var isRefreshig = false
6666

6767

6868
var isLight: Bool = {

Application/SCSHApp.entitlements

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
<array>
1212
<string>/usr/local/bin</string>
1313
<string>/usr/local/bin/syntax_highlight_cli</string>
14+
<string>/opt/sbarex</string>
15+
<string>/opt/sbarex/syntax_highlight_cli</string>
1416
</array>
1517
<key>com.apple.security.temporary-exception.files.home-relative-path.read-write</key>
1618
<array>

Application/SCSHWrapper.swift

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public class SCSHWrapper: NSObject {
9999
NotificationCenter.default.removeObserver(self, name: .ThemeNeedRefresh, object: nil)
100100
}
101101

102-
fileprivate (set) var isSaving = false
102+
fileprivate(set) var isSaving = false
103103

104104
func saveSettings(handler: ((Bool)->Void)?) {
105105
guard let service = SCSHWrapper.service, let settings = self.settings else {

0 commit comments

Comments
 (0)