Skip to content

Commit

Permalink
linux platform path issue - closes #11
Browse files Browse the repository at this point in the history
  • Loading branch information
darsan-in committed Nov 13, 2024
1 parent 2db4ab7 commit 9e54a41
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 8 deletions.
15 changes: 11 additions & 4 deletions lib/aggregator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,14 @@ import {
ytVideoMeta,
} from "./utilities";

import { basename, dirname, join, relative, resolve } from "node:path";
import {
basename,
dirname,
join,
relative,
resolve,
sep,
} from "node:path";
import { cwd } from "node:process";

import configurations from "../configLoader";
Expand Down Expand Up @@ -199,7 +206,7 @@ export function breadCrumb(htmlPath: string): breadCrumbListOptions {
const relativePath: string = relative(cwd(), htmlPath);

/* path branches in chronological order */
const pathTree: string[] = relativePath.split("\\");
const pathTree: string[] = relativePath.split(sep);

/* check if input htmlpath is index.html */
const sourceIsIndex: boolean = basename(htmlPath) === "index.html";
Expand All @@ -218,7 +225,7 @@ export function breadCrumb(htmlPath: string): breadCrumbListOptions {
/* assume in first iteration file
always exist so skip existance check */
if (firstIteration) {
let itemUrl: string = pathTree.join("\\");
let itemUrl: string = pathTree.join(sep);

const preserveBasename: boolean = sourceIsIndex ? false : true;

Expand All @@ -241,7 +248,7 @@ export function breadCrumb(htmlPath: string): breadCrumbListOptions {
} else {
//check if index html is available for each levels
// L1/L2 => L1/L2/index.html
const requiredFile: string = pathTree.join("\\") + "\\index.html";
const requiredFile: string = pathTree.join(sep) + `${sep}index.html`;

if (existsSync(requiredFile)) {
const listItem: breadCrumbMeta = generateMeta(
Expand Down
2 changes: 1 addition & 1 deletion test/outputs/OP_Of_(17) productCombined.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"description": "Product Description Lorem ipsum dolor sit amet, consectetur adipiscing elit.",
"url": "https://www.cresteem.com/test/test-sample/productVarient/productCombined",
"brand": { "@type": "Brand", "name": "XYZ Brand" },
"productGroupID": "a906d5c79402ec5b1d5600748a76796e",
"productGroupID": "80369227d029366a68317844038f619a",
"variesBy": ["color", "suggestedAge", "suggestedGender"],
"hasVariant": [
{
Expand Down
4 changes: 2 additions & 2 deletions test/outputs/OP_Of_(3) recipies.html
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@
"interactionStatistic": {
"@type": "InteractionCounter",
"interactionType": { "@type": "WatchAction" },
"userInteractionCount": 36005270
"userInteractionCount": 36005520
},
"expires": "3020-05-16T11:00:00+05:30"
}
Expand Down Expand Up @@ -168,7 +168,7 @@
"interactionStatistic": {
"@type": "InteractionCounter",
"interactionType": { "@type": "WatchAction" },
"userInteractionCount": 804942
"userInteractionCount": 804932
},
"expires": "3023-06-29T12:51:52+05:30"
}
Expand Down
2 changes: 1 addition & 1 deletion test/outputs/OP_Of_(4) recipies.html
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"interactionStatistic": {
"@type": "InteractionCounter",
"interactionType": { "@type": "WatchAction" },
"userInteractionCount": 36005270
"userInteractionCount": 36005520
},
"expires": "3020-05-16T11:00:00+05:30"
}
Expand Down

0 comments on commit 9e54a41

Please sign in to comment.