Skip to content

Commit

Permalink
Fix windows backslashes making broken websites (#177)
Browse files Browse the repository at this point in the history
  • Loading branch information
thomas-senechal authored Nov 27, 2024
1 parent 4e866ac commit 6d5cc55
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions cli/src/tasks/prepareChunk.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { readdirSync, readFileSync, statSync } from 'fs'
import { sha256 } from 'js-sha256'
import { ListrTask } from 'listr2'
import { join, relative } from 'path'
import { posix as path } from 'path'

import { Provider, SmartContract, U32 } from '@massalabs/massa-web3'

Expand Down Expand Up @@ -75,24 +75,24 @@ export function prepareBatchesTask(): ListrTask {
*/
async function prepareChunks(
provider: Provider,
path: string,
dirPath: string,
chunkSize: number,
sc?: SmartContract,
basePath: string = path
basePath: string = dirPath
): Promise<{
chunks: FileChunkPost[]
fileInits: FileInit[]
localFiles: string[]
}> {
const files = readdirSync(path)
const files = readdirSync(dirPath)

const chunks: FileChunkPost[] = []
const fileInits: FileInit[] = []

const localFiles: string[] = []

for (const file of files) {
const fullPath = join(path, file)
const fullPath = path.join(dirPath, file)
const stats = statSync(fullPath)

if (stats.isDirectory()) {
Expand All @@ -109,7 +109,7 @@ async function prepareChunks(
localFiles.push(...result.localFiles)
} else if (stats.isFile()) {
const data = readFileSync(fullPath)
const relativePath = relative(basePath, fullPath)
const relativePath = path.relative(basePath, fullPath)

localFiles.push(relativePath)

Expand Down

0 comments on commit 6d5cc55

Please sign in to comment.