-
Notifications
You must be signed in to change notification settings - Fork 101
/
generate-list.js
57 lines (48 loc) · 1.78 KB
/
generate-list.js
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
/*
Locations in /System/Library/ to check:
- PreferenceBundles: only two of the bundles seem to actually ontain
a SettingsSearchManifest.plist, but make sure to scan the entire
directory and examine all subfolders that aren't .lproj or .bundle
(excluding _CodeSignature) for .bundle directories.
- PreferenceManifests: Just one big bundle, AppleAccountSettingsSearch.bundle.
- PreferenceManifestsInternal: Two bundles, AccessibilitySettingsSearch.bundle
for accessibility settings and PreferenceManifests.bundle for
everything else.
*/
const mainPath = "/System/Library";
const { join } = require("path");
const { readdirSync } = require("fs");
const plist = require("simple-plist");
const dirs = [
"PreferenceBundles",
"PreferenceManifests",
"PreferenceManifestsInternal"
];
const locales = {};
const stringsDict = {};
const fsOptions = {
withFileTypes: true,
encoding: "utf-8"
}
for (const dir of dirs) {
const fullDirPath = join(mainPath, dir);
const bundleList = readdirSync(fullDirPath, fsOptions).filter(f => {
return (f.isDirectory() && f.name.endsWith(".bundle"));
})
for (const bundlePath of bundleList) {
const fullBundlePath = join(fullDirpath, bundlePath)
const fullItemList = readdirSync(fullBundlePath, fsOptions);
const urlDictList = fullItemList.filter(f => {
return (!f.isDirectory() && f.name.startsWith("SettingsSearchManifest"));
})
const lprojList = fullItemList.filter(f => {
return (f.isDirectory() && f.name.endsWith(".lproj"));
})
for (const lproj of lprojList) {
const localeName = lproj.name.split(".")[0];
if (!(localeName in locales)) locales[localeName] = {};
if (!(localeName in stringsDict)) stringsDict[localeName] = {};
const manifestStringsList = readdirSync(join())
}
}
}