Skip to content

Commit

Permalink
Possible fix for issue on osx (#1338)
Browse files Browse the repository at this point in the history
I believe OSX was unhappy with the empty string in the list, while
ubuntu and windows were okay with it. Also added logic to make sure if
the command fails the plugin doesn't try to split null.

closes #1336
  • Loading branch information
belav authored Aug 28, 2024
1 parent 90c6c28 commit 12fb058
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Src/CSharpier.Rider/.prettierrc.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
printWidth: 100
tabWidth: 4
plugins:
- prettier-plugin-java
- prettier-plugin-java
3 changes: 3 additions & 0 deletions Src/CSharpier.Rider/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

# csharpier-rider Changelog

## [1.8.1]
- Possible fix for issue with OSX not being able to run dotnet tool list command

## [1.8.0]
- Use dotnet tool list to find both local and global installs of csharpier.

Expand Down
2 changes: 1 addition & 1 deletion Src/CSharpier.Rider/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

pluginGroup = com.intellij.csharpier
pluginName = csharpier
pluginVersion = 1.8.0
pluginVersion = 1.8.1

# See https://plugins.jetbrains.com/docs/intellij/build-number-ranges.html
# for insight into build numbers and IntelliJ Platform versions.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,17 +141,21 @@ private String findCSharpierVersionInToolOutput(
String directoryThatContainsFile,
boolean isGlobal
) {
var command = List.of("tool", "list", (isGlobal ? "-g" : ""));
var command = isGlobal ? List.of("tool", "list", "-g") : List.of("tool", "list");
var output = DotNetProvider.getInstance(this.project).execDotNet(
command,
new File(directoryThatContainsFile)
);

this.logger.debug(
"Running 'dotnet tool list" + (isGlobal ? "-g" : "") + "' to look for version"
);
);
this.logger.debug("Output was: \n " + output);

if (output == null) {
return null;
}

var lines = Arrays.stream(output.split("\n"))
.map(String::trim)
.filter(line -> !line.isEmpty())
Expand Down

0 comments on commit 12fb058

Please sign in to comment.