-
Notifications
You must be signed in to change notification settings - Fork 0
/
skype.go
46 lines (37 loc) · 1.24 KB
/
skype.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
package main
import (
"io/ioutil"
"os"
"path/filepath"
)
type SkypeProfileDirectory struct {
Name string
MediaCache string
}
// findSkypeMediaCaches returns one or more (if the user has multiple Skype profiles) paths that could be Skype media caches
func findSkypeMediaCaches() []SkypeProfileDirectory {
var profileDirectories []SkypeProfileDirectory
appdata := os.Getenv("AppData")
if appdata == "" {
log.Fatalln("%AppData% is not set, I have no way of finding the Skype media cache")
}
files, err := ioutil.ReadDir(filepath.Join(appdata, "Skype"))
if err != nil {
log.Fatalln("Can't read %AppData%\\Skype: " + err.Error())
}
for _, f := range files {
if !f.IsDir() {
continue
}
// No one will have those as their Sykpe username
if f.Name() == "Content" || f.Name() == "DataRv" || f.Name() == "logs" || f.Name() == "shared_dynco" || f.Name() == "shared_httpfe" || f.Name() == "SkypeRT" {
continue
}
_, err := os.Stat(filepath.Join(appdata, "Skype", f.Name(), "media_messaging/media_cache_v3"))
if err != nil {
continue
}
profileDirectories = append(profileDirectories, SkypeProfileDirectory{f.Name(), filepath.Join(appdata, "Skype", f.Name(), "media_messaging/media_cache_v3")})
}
return profileDirectories
}