]> Git Repo - pico-vscode.git/commitdiff
FIX #73, cd command need '/d' option on Windows (cmd.exe). (#74)
authorpxysource <[email protected]>
Mon, 9 Sep 2024 13:35:09 +0000 (21:35 +0800)
committerGitHub <[email protected]>
Mon, 9 Sep 2024 13:35:09 +0000 (14:35 +0100)
src/utils/examplesUtil.mts
src/utils/gitUtil.mts

index 791e666505fb198bc876d23f79991afd73038500..9498774d72929cde48c0865df48ad64d11389c7a 100644 (file)
@@ -174,7 +174,9 @@ export async function setupExample(
 
   if (existsSync(joinPosix(examplesRepoPath, ".git"))) {
     const ref = await execAsync(
-      `cd "${examplesRepoPath}" && ${
+      `cd ${
+        process.env.ComSpec?.endsWith("cmd.exe") ? "/d " : " "
+      }"${examplesRepoPath}" && ${
         process.env.ComSpec === "powershell.exe" ? "&" : ""
       }"${gitPath}" rev-parse HEAD`
     );
index dbc3da1a02e9fce961a8e360ac3178d8d941debf..ed5f2badf2681bb2e2bc0c2b99f7d8cb83ab58f4 100644 (file)
@@ -55,8 +55,11 @@ export async function initSubmodules(
 ): Promise<boolean> {
   try {
     // Use the "git submodule update --init" command in the specified directory
+    // `cd` command need '/d' option on Windows. (Change drive "d:\" to "c:\")
     const command =
-      `cd "${sdkDirectory}" && ` +
+      `cd ${
+        process.env.ComSpec?.endsWith("cmd.exe") ? "/d " : " "
+      }"${sdkDirectory}" && ` +
       `${
         process.env.ComSpec === "powershell.exe" ? "&" : ""
       }"${gitExecutable}" submodule update --init`;
@@ -123,7 +126,9 @@ export async function sparseCloneRepository(
   try {
     await execAsync(cloneCommand);
     await execAsync(
-      `cd "${targetDirectory}" && ${
+      `cd ${
+        process.env.ComSpec?.endsWith("cmd.exe") ? "/d " : " " 
+      }"${targetDirectory}" && ${
         process.env.ComSpec === "powershell.exe" ? "&" : ""
       }"${gitExecutable}" sparse-checkout set --cone`
     );
@@ -165,7 +170,9 @@ export async function sparseCheckout(
 ): Promise<boolean> {
   try {
     await execAsync(
-      `cd "${repoDirectory}" && ${
+      `cd ${
+        process.env.ComSpec?.endsWith("cmd.exe") ? "/d " : " " 
+      } "${repoDirectory}" && ${
         process.env.ComSpec === "powershell.exe" ? "&" : ""
       }"${gitExecutable}" sparse-checkout add ${checkoutPath}`
     );
This page took 0.03084 seconds and 4 git commands to generate.