123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274 |
- import { promisified } from './tauri'
- import { BaseDirectory } from './fs'
- /**
- * @name appDir
- * @description Returns the path to the suggested directory for your app config files.
- * @return {Promise<string>}
- */
- async function appDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.App
- })
- }
- /**
- * @name audioDir
- * @description Returns the path to the user's audio directory.
- * @return {Promise<string>}
- */
- async function audioDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Audio
- })
- }
- /**
- * @name cacheDir
- * @description Returns the path to the user's cache directory.
- * @return {Promise<string>}
- */
- async function cacheDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Cache
- })
- }
- /**
- * @name configDir
- * @description Returns the path to the user's config directory.
- * @return {Promise<string>}
- */
- async function configDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Config
- })
- }
- /**
- * @name dataDir
- * @description Returns the path to the user's data directory.
- * @return {Promise<string>}
- */
- async function dataDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Data
- })
- }
- /**
- * @name desktopDir
- * @description Returns the path to the user's desktop directory.
- * @return {Promise<string>}
- */
- async function desktopDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Desktop
- })
- }
- /**
- * @name documentDir
- * @description Returns the path to the user's document directory.
- * @return {Promise<string>}
- */
- async function documentDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Document
- })
- }
- /**
- * @name downloadDir
- * @description Returns the path to the user's download directory.
- * @return {Promise<string>}
- */
- async function downloadDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Download
- })
- }
- /**
- * @name executableDir
- * @description Returns the path to the user's executable directory.
- * @return {Promise<string>}
- */
- async function executableDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Executable
- })
- }
- /**
- * @name fontDir
- * @description Returns the path to the user's font directory.
- * @return {Promise<string>}
- */
- async function fontDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Font
- })
- }
- /**
- * @name homeDir
- * @description Returns the path to the user's home directory.
- * @return {Promise<string>}
- */
- async function homeDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Home
- })
- }
- /**
- * @name localDataDir
- * @description Returns the path to the user's local data directory.
- * @return {Promise<string>}
- */
- async function localDataDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.LocalData
- })
- }
- /**
- * @name pictureDir
- * @description Returns the path to the user's picture directory.
- * @return {Promise<string>}
- */
- async function pictureDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Picture
- })
- }
- /**
- * @name publicDir
- * @description Returns the path to the user's public directory.
- * @return {Promise<string>}
- */
- async function publicDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Public
- })
- }
- /**
- * @name resourceDir
- * @description Returns the path to the user's resource directory.
- * @return {Promise<string>}
- */
- async function resourceDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Resource
- })
- }
- /**
- * @name runtimeDir
- * @descriptionReturns Returns the path to the user's runtime directory.
- * @return {Promise<string>}
- */
- async function runtimeDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Runtime
- })
- }
- /**
- * @name templateDir
- * @descriptionReturns Returns the path to the user's template directory.
- * @return {Promise<string>}
- */
- async function templateDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Template
- })
- }
- /**
- * @name videoDir
- * @descriptionReturns Returns the path to the user's video dir.
- * @return {Promise<string>}
- */
- async function videoDir(): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path: '',
- directory: BaseDirectory.Video
- })
- }
- /**
- * @name resolvePath
- * @descriptionReturns Resolves the path with the optional base directory.
- * @return {Promise<string>}
- */
- async function resolvePath(
- path: string,
- directory: BaseDirectory
- ): Promise<string> {
- return await promisified<string>({
- cmd: 'resolvePath',
- path,
- directory
- })
- }
- export {
- appDir,
- audioDir,
- cacheDir,
- configDir,
- dataDir,
- desktopDir,
- documentDir,
- downloadDir,
- executableDir,
- fontDir,
- homeDir,
- localDataDir,
- pictureDir,
- publicDir,
- resourceDir,
- runtimeDir,
- templateDir,
- videoDir,
- resolvePath
- }
|