alpha
Login
or
Join now
xcc.es
/
scripts
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
[READ-ONLY] Mirror of https://github.com/mrgnw/scripts.
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
executable is $1 or .thing
author
Morgan
date
2 years ago
(Dec 22, 2023, 1:15 PM -0700)
commit
6bd8583a
6bd8583a8300e4a63e20946acedd4902e64db634
parent
0538bc89
0538bc89c67e578ae1491b0cbb492d68eea5d6b3
+2
-5
1 changed file
Expand all
Collapse all
Unified
Split
+launcher
+2
-5
+launcher
View file
Reviewed
···
1
1
-
#! /usr/bin/env swift
2
2
-
// create a LaunchCTL launcher
3
1
import Foundation
4
2
5
5
-
let executableName = ".thing"
3
3
+
let executableName = CommandLine.arguments.count > 1 ? CommandLine.arguments[1] : ".thing"
6
4
let directoryPath = FileManager.default.currentDirectoryPath
7
5
let directoryName = URL(fileURLWithPath: directoryPath).lastPathComponent
8
6
9
9
-
// Use the directory name to create a unique plist filename
10
7
let plistFilename = "com.user.thingLauncher.\(directoryName).plist"
11
8
let plistPath = NSString(string: "~/Library/LaunchAgents/\(plistFilename)").expandingTildeInPath
12
9
13
13
-
// Define the dictionary for plist content
14
10
let plistDict: [String: Any] = [
15
11
"Label": "com.user.thingLauncher.\(directoryName)",
16
12
"ProgramArguments": ["\(directoryPath)/\(executableName)"],
···
37
33
print("LaunchAgent loaded successfully.")
38
34
} catch {
39
35
print("Error loading LaunchAgent: \(error)")
36
36
+
exit(1)
40
37
}