lean4-htt/src/Lean/Util/Paths.lean
Mac Malone ebba1e04d0
feat: frontend & server support for plugins (#6893)
This PR adds support for plugins to the frontend and server.

Implementation-wise, this adds a `plugins` argument to `runFrontend`,
`processHeader`, amd `importModules`, a `plugins` field to
`SetupImportsResult` and `FileSetupResult`. and a `pluginsPath` field to
`LeanPaths`, and then threads the value through these.
2025-02-04 23:36:18 +00:00

32 lines
942 B
Text

/-
Copyright (c) 2021 Sebastian Ullrich. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Authors: Sebastian Ullrich
-/
prelude
import Lean.Data.Json
import Lean.Util.Path
/-! Communicating Lean search paths between processes -/
namespace Lean
open System
structure LeanPaths where
oleanPath : SearchPath
srcPath : SearchPath
loadDynlibPaths : Array FilePath := #[]
pluginPaths : Array FilePath := #[]
deriving ToJson, FromJson
def initSrcSearchPath (pkgSearchPath : SearchPath := ∅) : IO SearchPath := do
let srcSearchPath := (← IO.getEnv "LEAN_SRC_PATH")
|>.map System.SearchPath.parse
|>.getD []
let srcPath := (← IO.appDir) / ".." / "src" / "lean"
-- `lake/` should come first since on case-insensitive file systems, Lean thinks that `src/` also contains `Lake/`
return srcSearchPath ++ pkgSearchPath ++ [srcPath / "lake", srcPath]
end Lean