diff --git a/README.md b/README.md index 27c0c0a..aaf3387 100644 --- a/README.md +++ b/README.md @@ -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', diff --git a/src/parser.ts b/src/parser.ts index 19feac7..4d8a9ea 100644 --- a/src/parser.ts +++ b/src/parser.ts @@ -191,7 +191,9 @@ export class Packwiz { * @returns The parsed file as a structured class. */ export async function parsePackwiz(filePath: string): Promise { - 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);