Skip to content

Commit efdb4bd

Browse files
committed
Extract env file method
1 parent 626ebb2 commit efdb4bd

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/main/java/org/scijava/plugins/scripting/python/OptionsPython.java

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -145,18 +145,25 @@ public void load() {
145145
}
146146

147147
public void rebuildEnv() {
148-
// Use scijava.app.python-env-file system property if present.
148+
File environmentYaml = getEnvironmentYamlFile();
149+
commandService.run(RebuildEnvironment.class, true, "environmentYaml",
150+
environmentYaml, "targetDir", pythonDir);
151+
}
152+
153+
/**
154+
* Returns the File for the environment.yml, using the system property if set.
155+
*/
156+
private File getEnvironmentYamlFile() {
149157
final Path appPath = appService.getApp().getBaseDirectory().toPath();
150158
File environmentYaml = appPath.resolve("config").resolve("environment.yml")
151159
.toFile();
152160
final String pythonEnvFileProp = System.getProperty(
153161
"scijava.app.python-env-file");
154162
if (pythonEnvFileProp != null) {
155-
environmentYaml = OptionsPython.stringToFile(appPath, pythonEnvFileProp);
163+
environmentYaml = stringToFile(appPath, pythonEnvFileProp);
156164
}
165+
return environmentYaml;
157166

158-
commandService.run(RebuildEnvironment.class, true, "environmentYaml",
159-
environmentYaml, "targetDir", pythonDir);
160167
}
161168

162169
@Override

0 commit comments

Comments
 (0)