package org.ghidra.bridge.runtime;

import ghidra.GhidraApplicationLayout;
import ghidra.GhidraLauncher;
import ghidra.framework.Application;
import ghidra.framework.HeadlessGhidraApplicationConfiguration;

public final class GhidraBootstrap {
    private GhidraBootstrap() {
    }

    public static void initialize(String installDir) throws Exception {
        if (Application.isInitialized()) {
            return;
        }
        System.setProperty("application.install.dir", installDir);
        GhidraApplicationLayout layout = GhidraLauncher.initializeGhidraEnvironment();
        HeadlessGhidraApplicationConfiguration config = new HeadlessGhidraApplicationConfiguration();
        config.setInitializeLogging(false);
        Application.initializeApplication(layout, config);
    }
}
