Skip to content

Commit

Permalink
fix version match
Browse files Browse the repository at this point in the history
  • Loading branch information
jyu49 committed Aug 21, 2023
1 parent 0865f75 commit be00929
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@ dist
node_modules
.vscode-test/
*.vsix
token.txt
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"icon": "images/vcpkg-logo.png",
"publisher": "JackBoosY",
"license": "MIT",
"version": "2.0.0",
"version": "2.0.1",
"engines": {
"vscode": "^1.76.0"
},
Expand Down
17 changes: 13 additions & 4 deletions src/settingsDocument.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,17 @@ export class SettingsDocument {

private getDependencyVersion(line: string)
{
let tmp = line.indexOf("\"version>=\"");
tmp = tmp + "\"version>=>=\"".length;
let tmp;
if (line.indexOf("\"version>=\"") !== -1)
{
tmp = line.indexOf("\"version>=\"");
tmp = tmp + "\"version>=\"".length;
}
else
{
tmp = line.indexOf("\"version\"");
tmp = tmp + "\"version\"".length;
}
let start = line.indexOf("\"", tmp);
let end = line.indexOf("\"", start + 1);
return line.substring(start + 1, end);
Expand Down Expand Up @@ -89,7 +98,7 @@ export class SettingsDocument {
}
tmpName = this.getDependencyName(line);
}
else if (line.search("\"version>=\"") !== -1)
else if (line.search("\"version>=\"") !== -1 && line.search("\"version\"") !== -1)
{
configs.push({name : tmpName, version: this.getDependencyVersion(line)});
tmpName = "";
Expand Down Expand Up @@ -122,7 +131,7 @@ export class SettingsDocument {

private currentDependencyName(currentLine: string, configText: string,allConfig: Array<Object>)
{
if (currentLine.search("\"version>=\"") !== -1)
if (currentLine.search("\"version>=\"") !== -1 && currentLine.search("\"version\"") !== -1 )
{
let lines = configText.split('\n');
for (let line in lines)
Expand Down

0 comments on commit be00929

Please sign in to comment.