forked from Vencord/Installer
-
Notifications
You must be signed in to change notification settings - Fork 4
/
find_discord_darwin.go
67 lines (56 loc) · 1.36 KB
/
find_discord_darwin.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
* SPDX-License-Identifier: GPL-3.0
* Vencord Installer, a cross platform gui/cli app for installing Vencord
* Copyright (c) 2023 Vendicated and Vencord contributors
*/
package main
import (
"fmt"
path "path/filepath"
"strings"
)
var macosNames = map[string]string{
"stable": "Discord.app",
"ptb": "Discord PTB.app",
"canary": "Discord Canary.app",
"dev": "Discord Development.app",
}
func ParseDiscord(p, branch string) *DiscordInstall {
if !ExistsFile(p) {
return nil
}
resources := path.Join(p, "/Contents/Resources")
if !ExistsFile(resources) {
return nil
}
if branch == "" {
branch = GetBranch(strings.TrimSuffix(p, ".app"))
}
app := path.Join(resources, "app")
return &DiscordInstall{
path: p,
branch: branch,
appPath: app,
isPatched: ExistsFile(app) || IsDirectory(path.Join(resources, "app.asar")),
isFlatpak: false,
isSystemElectron: false,
}
}
func FindDiscords() []any {
var discords []any
for branch, dirname := range macosNames {
p := "/Applications/" + dirname
if discord := ParseDiscord(p, branch); discord != nil {
fmt.Println("Found Discord Install at", p)
discords = append(discords, discord)
}
}
return discords
}
func PreparePatch(di *DiscordInstall) {}
func FixOwnership(_ string) error {
return nil
}
func CheckScuffedInstall() bool {
return false
}