From c82aa9f683ff50a0d3e704da01abae21684f62d1 Mon Sep 17 00:00:00 2001 From: Takeyoshi Kikuchi Date: Tue, 23 Jan 2024 16:05:45 +0900 Subject: [PATCH] config.nims: fix NimSuggest crash. When editing in VSCode, NimSuggest refers to config.nims and tries to find the NuttX .config. Fixed a problem that .config cannot be read because the environment variable "TOPDIR" is not defined. Signed-off-by: Takeyoshi Kikuchi --- config.nims | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/config.nims b/config.nims index 265573217..1bf0ac25b 100644 --- a/config.nims +++ b/config.nims @@ -127,6 +127,7 @@ proc setup_cfg(cfg: DotConfig) = switch("define", "nimMemAlignTiny") -let topdir = getEnv("TOPDIR") +const key = "TOPDIR" +let topdir = if existsEnv(key): getEnv(key) else: thisDir() & "/../nuttx" let cfg = read_config(topdir & "/.config") cfg.setup_cfg()