Skip to content

Commit

Permalink
Don't try to reach out to direct conda path in windows.
Browse files Browse the repository at this point in the history
  • Loading branch information
tinevez committed Jun 24, 2024
1 parent fe9020c commit 546c7a0
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/main/java/fiji/plugin/trackmate/util/cli/CLIUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,18 @@ public class CLIUtils

public static final String CONDA_PATH_PREF_KEY = "trackmate.conda.path";

public static String CONDA_COMMAND = "conda";

public static Map< String, String > getEnvMap()
{
// Create a map to store the environment names and paths
final Map< String, String > envMap = new HashMap<>();
try
{
final Process process = Runtime.getRuntime().exec( getCondaPath() + " env list" );
final ProcessBuilder pb;
if ( IJ.isWindows() )
pb = new ProcessBuilder( Arrays.asList( "cmd.exe", "/c", "conda", "env", "list" ) );
else
pb = new ProcessBuilder( Arrays.asList( getCondaPath(), "env", "list" ) );
final Process process = pb.start();
final BufferedReader reader = new BufferedReader( new InputStreamReader( process.getInputStream() ) );

// Read each line of output and extract the environment name and
Expand Down Expand Up @@ -76,6 +79,9 @@ public static List< String > getEnvList()

public static String getCondaPath()
{
if ( IJ.isWindows() )
return "conda";

final PrefService prefs = TMUtils.getContext().getService( PrefService.class );
String findPath;
try
Expand Down

0 comments on commit 546c7a0

Please sign in to comment.