mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-18 21:54:09 +00:00
refactor: migrate custom fields to transactions
refactor: extract functions to api domain refactor: strict custom field parsing refactor: remove rundown cache utilities refactor: directory restructure
This commit is contained in:
@@ -114,7 +114,7 @@ export async function dockerSafeRename(oldPath: PathLike, newPath: PathLike) {
|
||||
* finds potential file index number in our (*) format and increments
|
||||
* the number section (*) must be separated from the name by a space
|
||||
* @example incrementProjectNumber('test(1).json') -> 'test(1).json'
|
||||
* @example incrementProjectNumber('test (1).json') -> 'test(2).json'
|
||||
* @example incrementProjectNumber('test (1).json') -> 'test(2).json'
|
||||
*/
|
||||
export function incrementProjectNumber(path: string): string {
|
||||
const { dir, name, ext } = parse(path);
|
||||
@@ -129,3 +129,12 @@ export function incrementProjectNumber(path: string): string {
|
||||
|
||||
return join(dir, `${name.slice(0, openingParenIndex)} (${maybeNumber + 1})${ext}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* @description Delete file from system
|
||||
*/
|
||||
export const deleteFile = async (filePath: string) => {
|
||||
return await unlink(filePath).catch((error) => {
|
||||
console.error('Could not delete file:', error);
|
||||
});
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user