Skip to content

Commit 6b97d16

Browse files
author
David Hasani
committed
fix Windows path issue
1 parent fc6530d commit 6b97d16

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

packages/core/src/codewhisperer/service/transformByQ/transformApiHandler.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,15 @@ export async function zipCode(
378378
continue
379379
}
380380
const relativePath = path.relative(dependenciesFolder.path, file)
381-
zip.addLocalFile(file, path.dirname(relativePath))
381+
if (relativePath.includes('compilations.json')) {
382+
let fileContents = await nodefs.promises.readFile(file, 'utf-8')
383+
if (os.platform() === 'win32') {
384+
fileContents = fileContents.replace(/\\\\/g, '/')
385+
}
386+
zip.addFile('compilations.json', Buffer.from(fileContents, 'utf-8'))
387+
} else {
388+
zip.addLocalFile(file, path.dirname(relativePath))
389+
}
382390
dependencyFilesSize += (await nodefs.promises.stat(file)).size
383391
}
384392
getLogger().info(`CodeTransformation: dependency files size = ${dependencyFilesSize}`)

0 commit comments

Comments
 (0)