make the filepath consistent between Packwiz.location and Packwiz.index.location
Some checks failed
Actions / Build and Push Documentation (push) Has been cancelled

This commit is contained in:
cswimr 2025-02-09 13:38:42 -06:00
parent 6f25c57371
commit e84437d92c
Signed by: cswimr
GPG key ID: 0EC431A8DA8F8087
2 changed files with 4 additions and 2 deletions

View file

@ -16,7 +16,7 @@ See the [documentation](./docs) for more information.
> import { parsePackwiz } from "packwizjs";
> const packwizFile = await parsePackwiz("./packwiz/pack.toml")
Packwiz {
location: Resource { path: './packwiz/pack.toml' },
location: Resource { path: 'packwiz/pack.toml' },
index: { // The index file is automatically parsed alongside the pack.toml file
location: Resource { path: 'packwiz/index.toml' },
hash: '6ce48b376540c840b9c2c1eaedbdf64f3b0e1203888ea644fc5d8fff66377c18',

View file

@ -191,7 +191,9 @@ export class Packwiz {
* @returns The parsed file as a structured class.
*/
export async function parsePackwiz(filePath: string): Promise<Packwiz> {
const packwizFile = new Resource(filePath);
let packwizFile = new Resource(filePath);
// make the actual path consistent with the index file
packwizFile = packwizFile.parent.join(packwizFile.name);
const parsedPackwizFile = toml.parse(await packwizFile.fetchContents());
const indexFile = packwizFile.parent.join(parsedPackwizFile.index.file);