#24: Fix parsing of multiple paths where an earlier path contains an unclosed non-standard tag
This commit is contained in:
parent
af822f078c
commit
16c3911354
3 changed files with 98 additions and 88 deletions
|
@ -37749,13 +37749,6 @@ Aspects of change:
|
||||||
store: microsoft
|
store: microsoft
|
||||||
steam:
|
steam:
|
||||||
id: 1815780
|
id: 1815780
|
||||||
Asphalt Xtreme:
|
|
||||||
files:
|
|
||||||
'{{p|programfiles}}/WindowsApps/A278AB0D.AsphaltXtreme_1.7.3.8_x86__h6adky7gbf63m':
|
|
||||||
tags:
|
|
||||||
- config
|
|
||||||
when:
|
|
||||||
- os: windows
|
|
||||||
Asphyxia:
|
Asphyxia:
|
||||||
installDir:
|
installDir:
|
||||||
Asphyxia: {}
|
Asphyxia: {}
|
||||||
|
@ -45825,12 +45818,22 @@ Back to the Egg!:
|
||||||
- config
|
- config
|
||||||
when:
|
when:
|
||||||
- os: mac
|
- os: mac
|
||||||
<winDocuments>/Telltale Games/Episode */*.save|<winDocuments>/Telltale Games/Back to the Future 104/*.save:
|
<winDocuments>/Telltale Games/Back to the Future 104/*.save:
|
||||||
tags:
|
tags:
|
||||||
- save
|
- save
|
||||||
when:
|
when:
|
||||||
- os: windows
|
- os: windows
|
||||||
<winDocuments>/Telltale Games/Episode */prefs.prop|<winDocuments>/Telltale Games/Back to the Future 104/prefs.prop:
|
<winDocuments>/Telltale Games/Back to the Future 104/prefs.prop:
|
||||||
|
tags:
|
||||||
|
- config
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
<winDocuments>/Telltale Games/Episode */*.save:
|
||||||
|
tags:
|
||||||
|
- save
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
<winDocuments>/Telltale Games/Episode */prefs.prop:
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
when:
|
when:
|
||||||
|
@ -86478,11 +86481,6 @@ Cats are Liquid:
|
||||||
- save
|
- save
|
||||||
when:
|
when:
|
||||||
- os: windows
|
- os: windows
|
||||||
'{{p|HKEY_CURRENT_USER}}/SOFTWARE/LastQuarter Studios/Cats are Liquid':
|
|
||||||
tags:
|
|
||||||
- config
|
|
||||||
when:
|
|
||||||
- os: windows
|
|
||||||
installDir:
|
installDir:
|
||||||
Cats are Liquid: {}
|
Cats are Liquid: {}
|
||||||
launch:
|
launch:
|
||||||
|
@ -183422,14 +183420,6 @@ Farming Simulator 15:
|
||||||
store: steam
|
store: steam
|
||||||
steam:
|
steam:
|
||||||
id: 313160
|
id: 313160
|
||||||
Farming Simulator 16:
|
|
||||||
files:
|
|
||||||
'{{p|programfiles}}/WindowsApps/GIANTSSoftware.FarmingSimulator16_1.1.2.8_x86__fa8jxm5fj0esw':
|
|
||||||
tags:
|
|
||||||
- save
|
|
||||||
when:
|
|
||||||
- os: windows
|
|
||||||
store: microsoft
|
|
||||||
Farming Simulator 17:
|
Farming Simulator 17:
|
||||||
files:
|
files:
|
||||||
<winDocuments>/My Games/FarmingSimulator2017:
|
<winDocuments>/My Games/FarmingSimulator2017:
|
||||||
|
@ -298052,11 +298042,6 @@ Lucadian Chronicles:
|
||||||
- save
|
- save
|
||||||
when:
|
when:
|
||||||
- os: windows
|
- os: windows
|
||||||
'{{p|Linux}}~/.config/unity3d/melessthanthree/Lucah_ Born of a Dream':
|
|
||||||
tags:
|
|
||||||
- save
|
|
||||||
when:
|
|
||||||
- os: linux
|
|
||||||
installDir:
|
installDir:
|
||||||
Lucah Born of a Dream: {}
|
Lucah Born of a Dream: {}
|
||||||
launch:
|
launch:
|
||||||
|
@ -316473,13 +316458,6 @@ MetalArms:
|
||||||
MetalArms: {}
|
MetalArms: {}
|
||||||
steam:
|
steam:
|
||||||
id: 1155860
|
id: 1155860
|
||||||
'Metalheart: Replicants Rampage':
|
|
||||||
files:
|
|
||||||
'{{p|ProgramFiles}}/NumLock/Metalheart/data/save':
|
|
||||||
tags:
|
|
||||||
- save
|
|
||||||
when:
|
|
||||||
- os: windows
|
|
||||||
'Metaloid : Origin':
|
'Metaloid : Origin':
|
||||||
installDir:
|
installDir:
|
||||||
Morigin: {}
|
Morigin: {}
|
||||||
|
@ -372775,13 +372753,6 @@ Phantasy Star Online 2 New Genesis:
|
||||||
store: steam
|
store: steam
|
||||||
steam:
|
steam:
|
||||||
id: 1056640
|
id: 1056640
|
||||||
Phantasy Star Universe:
|
|
||||||
files:
|
|
||||||
'{{p|}}<winLocalAppData>/SEGA/PHANTASY STAR UNIVERSE/Psu.ini':
|
|
||||||
tags:
|
|
||||||
- config
|
|
||||||
when:
|
|
||||||
- os: windows
|
|
||||||
Phantom:
|
Phantom:
|
||||||
installDir:
|
installDir:
|
||||||
Phantom: {}
|
Phantom: {}
|
||||||
|
@ -410592,7 +410563,13 @@ Retro/Grade:
|
||||||
id: 222660
|
id: 222660
|
||||||
RetroArch:
|
RetroArch:
|
||||||
files:
|
files:
|
||||||
<base>/configs/*/*.opt|<base>/configs/*/*.cfg:
|
<base>/configs/*/*.cfg:
|
||||||
|
tags:
|
||||||
|
- config
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
- os: mac
|
||||||
|
<base>/configs/*/*.opt:
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
when:
|
when:
|
||||||
|
@ -428806,12 +428783,22 @@ Sam & Max Hit the Road:
|
||||||
id: 355170
|
id: 355170
|
||||||
Sam & Max Save the World:
|
Sam & Max Save the World:
|
||||||
files:
|
files:
|
||||||
<base>/*/*.save|<winDocuments>/Telltale Games/*/*.save:
|
<base>/*/*.save:
|
||||||
tags:
|
tags:
|
||||||
- save
|
- save
|
||||||
when:
|
when:
|
||||||
- os: windows
|
- os: windows
|
||||||
<base>/*/prefs.prop|<winDocuments>/Telltale Games/*/prefs.prop:
|
<base>/*/prefs.prop:
|
||||||
|
tags:
|
||||||
|
- config
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
<winDocuments>/Telltale Games/*/*.save:
|
||||||
|
tags:
|
||||||
|
- save
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
<winDocuments>/Telltale Games/*/prefs.prop:
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
when:
|
when:
|
||||||
|
@ -577384,12 +577371,22 @@ Wall to Wall:
|
||||||
id: 1027080
|
id: 1027080
|
||||||
Wallace & Gromit's Grand Adventures:
|
Wallace & Gromit's Grand Adventures:
|
||||||
files:
|
files:
|
||||||
<winDocuments>/Telltale Games/Wallace and Gromit Ep*/*.save|<winDocuments>/Telltale Games/Wallace & Gromit - */*.save:
|
<winDocuments>/Telltale Games/Wallace & Gromit - */*.save:
|
||||||
tags:
|
tags:
|
||||||
- save
|
- save
|
||||||
when:
|
when:
|
||||||
- os: windows
|
- os: windows
|
||||||
<winDocuments>/Telltale Games/Wallace and Gromit Ep*/prefs.prop|<winDocuments>/Telltale Games/Wallace & Gromit - */prefs.prop:
|
<winDocuments>/Telltale Games/Wallace & Gromit - */prefs.prop:
|
||||||
|
tags:
|
||||||
|
- config
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
<winDocuments>/Telltale Games/Wallace and Gromit Ep*/*.save:
|
||||||
|
tags:
|
||||||
|
- save
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
<winDocuments>/Telltale Games/Wallace and Gromit Ep*/prefs.prop:
|
||||||
tags:
|
tags:
|
||||||
- config
|
- config
|
||||||
when:
|
when:
|
||||||
|
|
|
@ -2244,6 +2244,7 @@
|
||||||
* [Asphalt 7: Heat](https://www.pcgamingwiki.com/wiki/?curid=24947)
|
* [Asphalt 7: Heat](https://www.pcgamingwiki.com/wiki/?curid=24947)
|
||||||
* [Asphalt Overdrive](https://www.pcgamingwiki.com/wiki/?curid=171874)
|
* [Asphalt Overdrive](https://www.pcgamingwiki.com/wiki/?curid=171874)
|
||||||
* [Asphalt Street Storm Racing](https://www.pcgamingwiki.com/wiki/?curid=171872)
|
* [Asphalt Street Storm Racing](https://www.pcgamingwiki.com/wiki/?curid=171872)
|
||||||
|
* [Asphalt Xtreme](https://www.pcgamingwiki.com/wiki/?curid=57248)
|
||||||
* [Asphyxia](https://www.pcgamingwiki.com/wiki/?curid=33642)
|
* [Asphyxia](https://www.pcgamingwiki.com/wiki/?curid=33642)
|
||||||
* [Aspire: Ina's Tale](https://www.pcgamingwiki.com/wiki/?curid=173772)
|
* [Aspire: Ina's Tale](https://www.pcgamingwiki.com/wiki/?curid=173772)
|
||||||
* [ASRECorp](https://www.pcgamingwiki.com/wiki/?curid=42155)
|
* [ASRECorp](https://www.pcgamingwiki.com/wiki/?curid=42155)
|
||||||
|
@ -11098,6 +11099,7 @@
|
||||||
* [Farming 6-in-1 bundle](https://www.pcgamingwiki.com/wiki/?curid=42746)
|
* [Farming 6-in-1 bundle](https://www.pcgamingwiki.com/wiki/?curid=42746)
|
||||||
* [Farming Giant](https://www.pcgamingwiki.com/wiki/?curid=40524)
|
* [Farming Giant](https://www.pcgamingwiki.com/wiki/?curid=40524)
|
||||||
* [Farming Life](https://www.pcgamingwiki.com/wiki/?curid=128371)
|
* [Farming Life](https://www.pcgamingwiki.com/wiki/?curid=128371)
|
||||||
|
* [Farming Simulator 16](https://www.pcgamingwiki.com/wiki/?curid=168192)
|
||||||
* [Farming Village](https://www.pcgamingwiki.com/wiki/?curid=144059)
|
* [Farming Village](https://www.pcgamingwiki.com/wiki/?curid=144059)
|
||||||
* [Farming World](https://www.pcgamingwiki.com/wiki/?curid=50324)
|
* [Farming World](https://www.pcgamingwiki.com/wiki/?curid=50324)
|
||||||
* [Farmington County](https://www.pcgamingwiki.com/wiki/?curid=148886)
|
* [Farmington County](https://www.pcgamingwiki.com/wiki/?curid=148886)
|
||||||
|
@ -19468,6 +19470,7 @@
|
||||||
* [Metal: Iron Age](https://www.pcgamingwiki.com/wiki/?curid=90252)
|
* [Metal: Iron Age](https://www.pcgamingwiki.com/wiki/?curid=90252)
|
||||||
* [MetalArms](https://www.pcgamingwiki.com/wiki/?curid=149503)
|
* [MetalArms](https://www.pcgamingwiki.com/wiki/?curid=149503)
|
||||||
* [MetälBörn](https://www.pcgamingwiki.com/wiki/?curid=180121)
|
* [MetälBörn](https://www.pcgamingwiki.com/wiki/?curid=180121)
|
||||||
|
* [Metalheart: Replicants Rampage](https://www.pcgamingwiki.com/wiki/?curid=35279)
|
||||||
* [Metaloid : Origin](https://www.pcgamingwiki.com/wiki/?curid=126010)
|
* [Metaloid : Origin](https://www.pcgamingwiki.com/wiki/?curid=126010)
|
||||||
* [Metamorph (Chumoran)](https://www.pcgamingwiki.com/wiki/?curid=121083)
|
* [Metamorph (Chumoran)](https://www.pcgamingwiki.com/wiki/?curid=121083)
|
||||||
* [Metamorphabet](https://www.pcgamingwiki.com/wiki/?curid=48062)
|
* [Metamorphabet](https://www.pcgamingwiki.com/wiki/?curid=48062)
|
||||||
|
@ -22904,6 +22907,7 @@
|
||||||
* [Phantasmat: The Dread of Oakville](https://www.pcgamingwiki.com/wiki/?curid=112812)
|
* [Phantasmat: The Dread of Oakville](https://www.pcgamingwiki.com/wiki/?curid=112812)
|
||||||
* [Phantasmat: The Endless Night](https://www.pcgamingwiki.com/wiki/?curid=62239)
|
* [Phantasmat: The Endless Night](https://www.pcgamingwiki.com/wiki/?curid=62239)
|
||||||
* [Phantasmata](https://www.pcgamingwiki.com/wiki/?curid=132901)
|
* [Phantasmata](https://www.pcgamingwiki.com/wiki/?curid=132901)
|
||||||
|
* [Phantasy Star Universe](https://www.pcgamingwiki.com/wiki/?curid=17795)
|
||||||
* [Phantasy Star Universe: Ambition of the Illuminus](https://www.pcgamingwiki.com/wiki/?curid=169291)
|
* [Phantasy Star Universe: Ambition of the Illuminus](https://www.pcgamingwiki.com/wiki/?curid=169291)
|
||||||
* [Phantom](https://www.pcgamingwiki.com/wiki/?curid=59661)
|
* [Phantom](https://www.pcgamingwiki.com/wiki/?curid=59661)
|
||||||
* [Phantom Astronaut Lucid VR](https://www.pcgamingwiki.com/wiki/?curid=149344)
|
* [Phantom Astronaut Lucid VR](https://www.pcgamingwiki.com/wiki/?curid=149344)
|
||||||
|
|
93
src/wiki.ts
93
src/wiki.ts
|
@ -293,6 +293,14 @@ function makePathArgRegex(arg: string): RegExp {
|
||||||
return new RegExp(escaped, "gi");
|
return new RegExp(escaped, "gi");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function normalizePath(path: string): string {
|
||||||
|
return path
|
||||||
|
.replace(/\\/g, "/")
|
||||||
|
.replace(/\/{2,}/g, "/")
|
||||||
|
.replace(/\/(?=$)/g, "")
|
||||||
|
.replace(/^~(?=($|\/))/, "<home>");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* https://www.pcgamingwiki.com/wiki/Template:Path
|
* https://www.pcgamingwiki.com/wiki/Template:Path
|
||||||
*/
|
*/
|
||||||
|
@ -315,11 +323,7 @@ function parsePath(path: string): [string, PathType] {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
path = path
|
path = normalizePath(path)
|
||||||
.replace(/\\/g, "/")
|
|
||||||
.replace(/\/{2,}/g, "/")
|
|
||||||
.replace(/\/(?=$)/g, "")
|
|
||||||
.replace(/^~(?=($|\/))/, "<home>")
|
|
||||||
.replace(/%userprofile%\/AppData\/Roaming/i, "<winAppData>")
|
.replace(/%userprofile%\/AppData\/Roaming/i, "<winAppData>")
|
||||||
.replace(/%userprofile%\/AppData\/Local(?!Low)/i, "<winLocalAppData>")
|
.replace(/%userprofile%\/AppData\/Local(?!Low)/i, "<winLocalAppData>")
|
||||||
.replace(/%userprofile%\/Documents/i, "<winDocuments>")
|
.replace(/%userprofile%\/Documents/i, "<winDocuments>")
|
||||||
|
@ -691,51 +695,56 @@ export function parseTemplates(templates: Array<string>): Pick<Game, "files" | "
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const [path, pathType] = parsePath(rawPath);
|
const [pathUnsplit, pathType] = parsePath(rawPath);
|
||||||
if (pathIsTooBroad(path)) {
|
if (pathUnsplit.includes("{{")) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
for (const path of pathUnsplit.split("|").map(normalizePath)) {
|
||||||
if (pathType === PathType.FileSystem) {
|
if (pathIsTooBroad(path)) {
|
||||||
const constraint = getConstraintFromSystem(system, rawPath);
|
continue;
|
||||||
|
|
||||||
if (!game.files.hasOwnProperty(path)) {
|
|
||||||
game.files[path] = {
|
|
||||||
when: [],
|
|
||||||
tags: [],
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!game.files[path].when.some(x => x.os === constraint.os && x.store === constraint.store)) {
|
if (pathType === PathType.FileSystem) {
|
||||||
if (constraint.os !== undefined && constraint.store !== undefined) {
|
const constraint = getConstraintFromSystem(system, rawPath);
|
||||||
game.files[path].when.push(constraint);
|
|
||||||
} else if (constraint.os !== undefined) {
|
if (!game.files.hasOwnProperty(path)) {
|
||||||
game.files[path].when.push({ os: constraint.os });
|
game.files[path] = {
|
||||||
} else if (constraint.store !== undefined) {
|
when: [],
|
||||||
game.files[path].when.push({ store: constraint.store });
|
tags: [],
|
||||||
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
const tag = getTagFromTemplate(template.name);
|
if (!game.files[path].when.some(x => x.os === constraint.os && x.store === constraint.store)) {
|
||||||
if (tag !== undefined && !game.files[path].tags.includes(tag)) {
|
if (constraint.os !== undefined && constraint.store !== undefined) {
|
||||||
game.files[path].tags.push(tag);
|
game.files[path].when.push(constraint);
|
||||||
}
|
} else if (constraint.os !== undefined) {
|
||||||
} else if (pathType === PathType.Registry) {
|
game.files[path].when.push({ os: constraint.os });
|
||||||
if (!game.registry.hasOwnProperty(path)) {
|
} else if (constraint.store !== undefined) {
|
||||||
game.registry[path] = {
|
game.files[path].when.push({ store: constraint.store });
|
||||||
when: [],
|
}
|
||||||
tags: [],
|
}
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
const store = getStoreConstraintFromPath(rawPath);
|
const tag = getTagFromTemplate(template.name);
|
||||||
if (store !== undefined && !game.registry[path].when.some(x => x.store === store)) {
|
if (tag !== undefined && !game.files[path].tags.includes(tag)) {
|
||||||
game.registry[path].when.push({ store });
|
game.files[path].tags.push(tag);
|
||||||
}
|
}
|
||||||
|
} else if (pathType === PathType.Registry) {
|
||||||
|
if (!game.registry.hasOwnProperty(path)) {
|
||||||
|
game.registry[path] = {
|
||||||
|
when: [],
|
||||||
|
tags: [],
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
const tag = getTagFromTemplate(template.name);
|
const store = getStoreConstraintFromPath(rawPath);
|
||||||
if (tag !== undefined && !game.registry[path].tags.includes(tag)) {
|
if (store !== undefined && !game.registry[path].when.some(x => x.store === store)) {
|
||||||
game.registry[path].tags.push(tag);
|
game.registry[path].when.push({ store });
|
||||||
|
}
|
||||||
|
|
||||||
|
const tag = getTagFromTemplate(template.name);
|
||||||
|
if (tag !== undefined && !game.registry[path].tags.includes(tag)) {
|
||||||
|
game.registry[path].tags.push(tag);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue