Template Upload
Template Launch
Template Deletion
This commit is contained in:
valerio
2026-07-25 16:56:25 +02:00
parent 29bf3dfa66
commit 1cecec5a97
3 changed files with 63 additions and 42 deletions
+15 -6
View File
@@ -11,7 +11,7 @@ import europa from '$lib/assets/fonts/Europa-Mono-Medium.otf';
import { BASE_LIBRARY_DIR } from './settings';
import figlet from 'figlet';
import shadow from 'figlet/fonts/Classy';
import { getInstalledVersions } from './library';
import { getInstalledVersions, getTemplatesDir } from './library';
figlet.parseFont('Big', shadow);
/**
@@ -120,14 +120,23 @@ export async function createBanner(text) {
});
}
export async function addTemplateFile(version, templateFilePath) {
const newFileName = await pathBasename(templateFilePath);
const templatesPath = await join(version.path, 'templates', newFileName);
await copyFile(templateFilePath, templatesPath);
export async function addTemplateFile(version, filePath) {
const newFileName = await pathBasename(filePath);
const templateName = newFileName.replace(/\.blend$/i, '');
const newTemplatePath = await join(await getTemplatesDir(version), templateName);
await ensureDirectory(newTemplatePath)
const newTemplateFile = await join(newTemplatePath, 'startup.blend');
try {
await copyFile(filePath, newTemplateFile);
} catch (error) {
console.error('Error adding template file:', error);
return;
}
await getInstalledVersions();
console.log('adding ', templateFilePath, ' to ', version.path);
console.log('adding ', filePath, ' to ', newTemplateFile);
}
/**