1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-07 06:30:06 +00:00

chore: code fixes

This commit is contained in:
Saad Jutt
2022-06-14 16:48:58 +05:00
parent de9ed15286
commit c830f44e29
9 changed files with 343 additions and 310 deletions

View File

@@ -0,0 +1,18 @@
import path from 'path'
import { fileExists } from '@sasjs/utils'
import { getFilesFolder } from './file'
export const getRunTimeAndFilePath = async (programPath: string) => {
for (const runTime of process.runTimes) {
const codePath =
path
.join(getFilesFolder(), programPath)
.replace(new RegExp('/', 'g'), path.sep) +
'.' +
runTime
if (await fileExists(codePath)) return { codePath, runTime }
}
throw `The Program at (${programPath}) does not exist.`
}