1
1
import * as vscode from 'vscode' ;
2
+ import * as path from 'path' ;
2
3
import { randomUUID } from 'crypto' ;
3
4
import { tmpdir } from 'os' ;
4
5
import { existsSync , readFileSync , unlinkSync , writeFileSync } from 'fs' ;
@@ -19,8 +20,8 @@ export async function getCommitMessage(
19
20
) {
20
21
const gptcommit = config . gptcommitPath || "gptcommit" ;
21
22
const uid = randomUUID ( ) ;
22
- const tmpMsgFile = ` ${ tmpdir ( ) } / vscode-gptcommit-${ uid } .txt`;
23
- const tmpDiffFile = ` ${ tmpdir ( ) } / vscode-gptcommit-${ uid } .diff`;
23
+ const tmpMsgFile = path . join ( tmpdir ( ) , ` vscode-gptcommit-${ uid } .txt`) ;
24
+ const tmpDiffFile = path . join ( tmpdir ( ) , ` vscode-gptcommit-${ uid } .diff`) ;
24
25
const onFiles = config . onFiles || 'tryStagedThenUnstaged' ;
25
26
26
27
return vscode . window . withProgress ( {
@@ -44,7 +45,7 @@ export async function getCommitMessage(
44
45
channel . appendLine ( `COMMAND: ${ cmd } ` ) ;
45
46
return new Promise < string > ( ( resolve , reject ) => {
46
47
exec ( cmd , {
47
- cwd : repo . rootUri . path
48
+ cwd : repo . rootUri . fsPath
48
49
} , ( err , stdout , stderr ) => {
49
50
channel . appendLine ( `STDOUT: ${ stdout } ` ) ;
50
51
channel . appendLine ( `STDERR: ${ stderr } ` ) ;
@@ -58,7 +59,7 @@ export async function getCommitMessage(
58
59
// set allow-amend to true
59
60
const cmd = `${ gptcommit } config set allow_amend true` ;
60
61
channel . appendLine ( `COMMAND: ${ cmd } ` ) ;
61
- execSync ( cmd , { cwd : repo . rootUri . path } ) ;
62
+ execSync ( cmd , { cwd : repo . rootUri . fsPath } ) ;
62
63
// try again
63
64
getCommitMessage ( config , repo , context , channel ) . then ( ( msg ) => {
64
65
resolve ( msg ) ;
0 commit comments