Add download location settings

This commit is contained in:
Geomitron
2024-07-12 15:42:41 -05:00
parent 91e80aed52
commit 7968592893
13 changed files with 168 additions and 52 deletions

View File

@@ -1,20 +1,11 @@
import { randomBytes } from 'crypto'
import { basename, parse } from 'path'
import { parse } from 'path'
import sanitize from 'sanitize-filename'
import { inspect } from 'util'
import { lower } from '../src-shared/UtilFunctions.js'
import { settings } from './ipc/SettingsHandler.ipc.js'
import { emitIpcEvent } from './main.js'
/**
* @returns The relative filepath from the library folder to `absoluteFilepath`.
*/
export async function getRelativeFilepath(absoluteFilepath: string) {
if (!settings.libraryPath) { throw 'getRelativeFilepath() failed; libraryPath is undefined' }
return basename(settings.libraryPath) + absoluteFilepath.substring(settings.libraryPath.length)
}
/**
* @returns `true` if `name` has a valid video file extension.
*/