/
paths.ts
40 lines (34 loc) · 1.18 KB
/
paths.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
/**
* @file This file is part of the Keywork project.
* @copyright Nirrius, LLC. All rights reserved.
* @author Teffen Ellis, et al.
* @license AGPL-3.0
*
* @remarks Keywork is free software for non-commercial purposes.
* You can be released from the requirements of the license by purchasing a commercial license.
* Buying such a license is mandatory as soon as you develop commercial activities
* involving the Keywork software without disclosing the source code of your own applications.
*
* @see LICENSE.md in the project root for further licensing information.
*/
import * as path from 'deno/path'
const __filename = path.fromFileUrl(import.meta.url)
/**
* The absolute path to the project root.
*/
export const projectRoot = path.dirname(__filename)
/**
* A path builder to the absolute project root.
* @type {(...paths: string[]) => string}
*/
export const projectPath = path.join.bind(null, projectRoot)
/**
*
* @param {string} filePath
* @param {string} extension
* @returns {string}
*/
export function changeExtension(filePath: string, extension: string) {
const parsedPath = path.parse(filePath)
return parsedPath.dir + path.sep + parsedPath.name + extension
}