| | import org.jetbrains.annotations.NotNull; |
| | |
| | -import java.nio.file.Path; |
| | import java.util.HashMap; |
| | import java.util.concurrent.atomic.AtomicBoolean; |
 |
| | */ |
| | public void init() { |
| | - final var bootstrap = getBootstrapScript(); |
| | + final var context = getContext(); |
| | + final var bootstrap = context.getRScript(); |
| | |
| | if( !bootstrap.isBlank() ) { |
| | - final var wd = getWorkingDirectory(); |
| | + final var wd = context.getRWorkingDir(); |
| | final var dir = wd.toString().replace( '\\', '/' ); |
| | final var definitions = getContext().getDefinitions(); |
 |
| | Engine.eval( replace( bootstrap, map ) ); |
| | mReady.set( true ); |
| | - } catch( final Exception ignored ) { |
| | + } catch( final Exception ex ) { |
| | + clue( ex ); |
| | // A problem with the bootstrap script is likely caused by variables |
| | // not being loaded. This implies that the R processor is being invoked |
 |
| | // Copy from the previous index to the end of the string. |
| | return sb.append( text.substring( min( prevIndex, length ) ) ).toString(); |
| | - } |
| | - |
| | - /** |
| | - * Return the given path if not {@code null}, otherwise return the path to |
| | - * the user's directory. |
| | - * |
| | - * @return A non-null path. |
| | - */ |
| | - private Path getWorkingDirectory() { |
| | - return getContext().getRWorkingDir(); |
| | - } |
| | - |
| | - /** |
| | - * Loads the R init script from the application's persisted preferences. |
| | - * |
| | - * @return A non-null string, possibly empty. |
| | - */ |
| | - private String getBootstrapScript() { |
| | - return getContext().getRScript(); |
| | } |
| | } |