Skip to content

Commit

Permalink
Merge branch 'feat/check-PATH' into experimental
Browse files Browse the repository at this point in the history
* feat/check-PATH:
  Tweak of path finding
  feat(process-manager): check PATH folders for NEURON executables also
  chore(process-manager): add new NEURON release versions
  • Loading branch information
pgleeson committed Nov 23, 2022
2 parents 71f6c27 + e91b8f3 commit dfc59ac
Showing 1 changed file with 20 additions and 3 deletions.
23 changes: 20 additions & 3 deletions src/main/java/org/neuroml/export/neuron/ProcessManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,17 @@ public static File findNeuronHome() throws NeuroMLException
String nrnEnvVar = System.getenv(NeuronWriter.NEURON_HOME_ENV_VAR);
String[] knownVersions = new String[]
{
"7.5", "7.4", "7.3", "7.2", "7.1", "6.2", "6.1", "6.0"
"8.2.1", "8.2.0", "8.1.0", "8.0.2", "8.0.1", "8.0.0",
"7.8.2", "7.8.1", "7.7.1", "7.6.7", "7.5", "7.4", "7.3", "7.2", "7.1",
"6.2", "6.1", "6.0"
};

if (nrnEnvVar != null)
/* If NEURON_HOME is defined, it gets priority */
if (nrnEnvVar != null && nrnEnvVar.length()>0)
{
options.add(nrnEnvVar);
}
/* If NEURON_HOME is not defined, check all the usual suspects */
else if (Utils.isWindowsBasedPlatform())
{
for (String ver : knownVersions)
Expand All @@ -52,6 +56,12 @@ else if (Utils.isWindowsBasedPlatform())
}
else if (Utils.isMacBasedPlatform())
{
/* Check folders in PATH */
for (String folder: System.getenv("PATH").split(";")) {
options.add(folder);
}

/* Other possible folders */
for (String ver : knownVersions)
{
options.add("/Applications/NEURON-" + ver + "/nrn/powerpc");
Expand All @@ -63,6 +73,13 @@ else if (Utils.isMacBasedPlatform())
}
else if (Utils.isLinuxBasedPlatform())
{

/* Check folders in PATH */
for (String folder: System.getenv("PATH").split(";")) {
options.add(folder);
}

/* Other possible folders */
options.add("/usr");
options.add("/usr/local");
options.add("/usr/local/nrn/x86_64");
Expand All @@ -84,7 +101,7 @@ else if (Utils.isLinuxBasedPlatform())

String env = Utils.sysEnvInfo(" ");

throw new NeuroMLException("Could not find NEURON home directory! Options tried: " + options
throw new NeuroMLException("Could not find NEURON home directory! Options tried here: " + options
+ "\nThe NEURON executable which is sought inside this directory is: " + nrnExe + ". \n\n"
+ "Try setting the environment variable " + NeuronWriter.NEURON_HOME_ENV_VAR
+ " to the location of your NEURON installation (up to but not including bin), e.g.\n\n"
Expand Down

0 comments on commit dfc59ac

Please sign in to comment.