diff options
author | Kait Lam <k@rina.fyi> | 2024-03-11 08:44:35 +1000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-10 17:44:35 -0500 |
commit | 51da64cefb4778db5c8c30260f49654f3a419dbd (patch) | |
tree | f8c9f946ce0667bf16d28bf74bc52b2b61da3573 | |
parent | 8dd09d1c1f0e44db48d6fa42083a42377dd572fe (diff) | |
download | compiler-explorer-gh-10945.tar.gz compiler-explorer-gh-10945.zip |
builtin.ts: treat EXAMPLES_PATH as relative to app root. (#6237)gh-10945
I feel this is the least surprising behaviour most of the time. This
will help when packaging and distributing the application.
It may also make sense to base this at rootDir, but examples/ sits
outside etc/ at the moment and I didn't want to disturb that too much.
Thanks!
-rw-r--r-- | lib/sources/builtin.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/sources/builtin.ts b/lib/sources/builtin.ts index d95a018d9..dda448971 100644 --- a/lib/sources/builtin.ts +++ b/lib/sources/builtin.ts @@ -26,11 +26,12 @@ import fs from 'fs'; import fsp from 'fs/promises'; import path from 'path'; +import * as utils from '../utils.js'; import * as props from '../properties.js'; import type {Source, SourceEntry} from './index.js'; -const EXAMPLES_PATH = props.get('builtin', 'sourcePath', './examples/'); +const EXAMPLES_PATH = utils.resolvePathFromAppRoot(props.get('builtin', 'sourcePath', './examples/')); const NAME_SUBSTUTION_PATTERN = new RegExp('_', 'g'); const ALL_EXAMPLES: SourceEntry[] = fs.readdirSync(EXAMPLES_PATH).flatMap(folder => { // Recurse through the language folders |