Skip to content

The app doesn't run on Windows because of the double backslash pattern on blob lib #61

@forcella

Description

@forcella

When it's called blob.sync(param) on the Windows platform the result of the blob sync is something like this [path\\to\\something.ext1]

https://github.com/stackbit-themes/ts-mui-nextjs-starter/blob/0240791d85f5a10062662e5555c930108c80798f/src/utils/content.ts#L15

Then on the following line, the result is "null" because the path doesn't start with 'content/data'.

https://github.com/stackbit-themes/ts-mui-nextjs-starter/blob/0240791d85f5a10062662e5555c930108c80798f/src/utils/content.ts#L42

My solution for now is to force the platform as "Linux":

function contentFilesInPath(dir: string) {
    const globPattern = `${dir}/**/*.{${supportedFileTypes.join(',')}}`;
    return glob.sync(globPattern, {platform: 'linux'});
}

It's also possible to string.replace(param1, param2) the double backslash for a slash

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions