-
-
Notifications
You must be signed in to change notification settings - Fork 87
/
find_discord_darwin.go
73 lines (62 loc) · 1.46 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
68
69
70
71
72
73
/*
* 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 (
"os"
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(path.Join(resources, "_app.asar")),
isFlatpak: false,
isSystemElectron: false,
}
}
func FindDiscords() []any {
var discords []any
bases := []string{
"/Applications",
path.Join(os.Getenv("HOME"), "Applications"),
}
for branch, dirname := range macosNames {
for _, base := range bases {
p := path.Join(base, dirname)
if discord := ParseDiscord(p, branch); discord != nil {
Log.Debug("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
}