FIX:
Template Upload Template Launch Template Deletion
This commit is contained in:
+15
-6
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user