@@ -14,13 +14,11 @@ import { toWslPath, useWsl } from "./utils/wslUtils";
1414
1515class LeetCodeExecutor implements Disposable {
1616private leetCodeRootPath :string ;
17- private leetCodeRootPathInWsl :string ;
1817private nodeExecutable :string ;
1918private configurationChangeListener :Disposable ;
2019
2120constructor ( ) {
2221this . leetCodeRootPath = path . join ( __dirname , ".." , ".." , "node_modules" , "vsc-leetcode-cli" ) ;
23- this . leetCodeRootPathInWsl = "" ;
2422this . nodeExecutable = this . getNodePath ( ) ;
2523this . configurationChangeListener = workspace . onDidChangeConfiguration ( ( event :ConfigurationChangeEvent ) => {
2624if ( event . affectsConfiguration ( "leetcode.nodePath" ) ) {
@@ -29,18 +27,11 @@ class LeetCodeExecutor implements Disposable {
2927} , this ) ;
3028}
3129
32- public async getLeetCodeRootPath ( ) :Promise < string > { // not wrapped by ""
30+ public async getLeetCodeBinaryPath ( ) :Promise < string > {
3331if ( wsl . useWsl ( ) ) {
34- if ( ! this . leetCodeRootPathInWsl ) {
35- this . leetCodeRootPathInWsl = `${ await wsl . toWslPath ( this . leetCodeRootPath ) } ` ;
36- }
37- return `${ this . leetCodeRootPathInWsl } ` ;
32+ return `${ await wsl . toWslPath ( `"${ path . join ( this . leetCodeRootPath , "bin" , "leetcode" ) } "` ) } ` ;
3833}
39- return `${ this . leetCodeRootPath } ` ;
40- }
41-
42- public async getLeetCodeBinaryPath ( ) :Promise < string > { // wrapped by ""
43- return `"${ path . join ( await this . getLeetCodeRootPath ( ) , "bin" , "leetcode" ) } "` ;
34+ return `"${ path . join ( this . leetCodeRootPath , "bin" , "leetcode" ) } "` ;
4435}
4536
4637public async meetRequirements ( ) :Promise < boolean > {
@@ -168,7 +159,7 @@ class LeetCodeExecutor implements Disposable {
168159
169160public async getCompaniesAndTags ( ) :Promise < { companies :{ [ key :string ] :string [ ] } , tags :{ [ key :string ] :string [ ] } } > {
170161// preprocess the plugin source
171- const companiesTagsPath :string = path . join ( await leetCodeExecutor . getLeetCodeRootPath ( ) , "lib" , "plugins" , "company.js" ) ;
162+ const companiesTagsPath :string = path . join ( this . leetCodeRootPath , "lib" , "plugins" , "company.js" ) ;
172163const companiesTagsSrc :string = ( await fse . readFile ( companiesTagsPath , "utf8" ) ) . replace (
173164"module.exports = plugin" ,
174165"module.exports = { COMPONIES, TAGS }" ,