Skip to content

Commit a9f9aae

Browse files
committed
tools: fix translate for OSX+Win
1 parent 9af0f49 commit a9f9aae

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tools/translate.mjs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { GenerativeModel, GoogleGenerativeAI } from "@google/generative-ai";
22
import { existsSync, mkdirSync, readdirSync, readFileSync, statSync, writeFileSync } from "fs";
3-
import path, { basename } from "path";
3+
import path, { basename, dirname } from "path";
44
import { createHash } from "crypto";
55
import dotenv from 'dotenv';
66
dotenv.config();
@@ -87,7 +87,7 @@ export async function translateDocumentation() {
8787
console.error("No translated content found for file:", sourceFile.filepath);
8888
return;
8989
}
90-
const localDir = targetPath.substring(0, targetPath.lastIndexOf("/"));
90+
const localDir = dirname(targetPath);
9191
console.log(`Saving translation (${langCode}) to ${localDir}`);
9292
mkdirSync(localDir, { recursive: true });
9393
writeFileSync(targetPath, translatedContent);

0 commit comments

Comments
 (0)