feat: add current working directory to path api module (#1375)

This commit is contained in:
Amr Bashir
2021-03-23 03:13:12 +02:00
committed by GitHub
parent 5b3d9b2c07
commit 52c2baf940
4 changed files with 31 additions and 2 deletions

View File

@@ -18,7 +18,8 @@ export enum BaseDirectory {
Template,
Video,
Resource,
App
App,
Current
}
export interface FsOptions {

View File

@@ -289,6 +289,22 @@ async function videoDir(): Promise<string> {
})
}
/**
* @name currentDir
* @descriptionReturns Returns the path to the current working dir.
* @return {Promise<string>}
*/
async function currentDir(): Promise<string> {
return invokeTauriCommand<string>({
__tauriModule: 'Fs',
message: {
cmd: 'resolvePath',
path: '',
directory: BaseDirectory.Current
}
})
}
/**
* @name resolvePath
* @descriptionReturns Resolves the path with the optional base directory.
@@ -327,5 +343,6 @@ export {
runtimeDir,
templateDir,
videoDir,
currentDir,
resolvePath
}