diff --git a/.vscode/settings.json b/.vscode/settings.json index 1f722a0e8..504026725 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,10 @@ }, "editor.defaultFormatter": "esbenp.prettier-vscode", "editor.formatOnSave": true, - "rust-analyzer.linkedProjects": [".\\src-tauri\\Cargo.toml"] + "rust-analyzer.linkedProjects": [ + ".\\src-tauri\\Cargo.toml" + ], + "[vue]": { + "editor.defaultFormatter": "Wscats.vue" + } } diff --git a/src/components/Greet/Greet.vue b/src/components/Greet/Greet.vue index 52692f579..ec616ac2c 100644 --- a/src/components/Greet/Greet.vue +++ b/src/components/Greet/Greet.vue @@ -7,6 +7,7 @@ import TextButton from '@/components/Common/TextButton.vue' import Notification from '@/components/Notifications/Notification.vue' import { PWAFileSystem } from '@/libs/fileSystem/PWAFileSystem' +import { join } from 'pathe' import { computed, ref } from 'vue' import { useTranslate } from '@/libs/locales/Locales' import { ProjectInfo, ProjectManager, useConvertableProjects, useCurrentProject, useProjects } from '@/libs/project/ProjectManager' @@ -19,6 +20,7 @@ import { useBridgeFolderUnloaded, } from '@/libs/fileSystem/FileSystem' import { CreateProjectWindow } from '@/components/Windows/CreateProject/CreateProjectWindow' +import { EditProjectWindow } from '@/components/Windows/EditProject/EditProjectWindow' import { NotificationSystem } from '@/components/Notifications/NotificationSystem' import { convertProject } from '@/libs/project/ConvertComMojangProject' @@ -46,7 +48,11 @@ async function openProject(project: ProjectInfo) { ProjectManager.loadProject(project.name) } -async function edit(name: string) {} +async function edit(name: string) { + const projectInfo = await ProjectManager.getProjectInfo(join('/projects', name)) + if(!projectInfo) throw new Error("Failed to get project info!") + Windows.open(new EditProjectWindow(projectInfo)) +} const bridgeFolderUnloaded = useBridgeFolderUnloaded() diff --git a/src/components/Windows/CreateProject/CreateProject.vue b/src/components/Windows/CreateProject/CreateProject.vue index 27fc56c2c..0d40c79ac 100644 --- a/src/components/Windows/CreateProject/CreateProject.vue +++ b/src/components/Windows/CreateProject/CreateProject.vue @@ -1,410 +1,472 @@ diff --git a/src/components/Windows/EditProject/EditProject.vue b/src/components/Windows/EditProject/EditProject.vue new file mode 100644 index 000000000..1596776b4 --- /dev/null +++ b/src/components/Windows/EditProject/EditProject.vue @@ -0,0 +1,181 @@ + + + diff --git a/src/components/Windows/EditProject/EditProjectWindow.ts b/src/components/Windows/EditProject/EditProjectWindow.ts new file mode 100644 index 000000000..f205e6f3d --- /dev/null +++ b/src/components/Windows/EditProject/EditProjectWindow.ts @@ -0,0 +1,14 @@ +import { Settings } from '@/libs/settings/Settings' +import { Window } from '../Window' +import EditProject from './EditProject.vue' +import { ProjectInfo, ProjectManager } from '@/libs/project/ProjectManager' +import { basename, join } from 'pathe' + +export class EditProjectWindow extends Window { + public static id = 'editProject' + public component = EditProject + + constructor(public projectInfo: ProjectInfo) { + super() + } +} \ No newline at end of file diff --git a/src/libs/fileSystem/BaseFileSystem.ts b/src/libs/fileSystem/BaseFileSystem.ts index 880345bf5..75cf66f30 100644 --- a/src/libs/fileSystem/BaseFileSystem.ts +++ b/src/libs/fileSystem/BaseFileSystem.ts @@ -170,7 +170,7 @@ export class BaseFileSystem { throw new Error('Not implemented!') } - public async ingorePath(path: string) { + public async ignorePath(path: string) { this.watchPathsToIgnore.push(path) } diff --git a/src/libs/project/Project.ts b/src/libs/project/Project.ts index bdc9cfaf2..f8c63cb1d 100644 --- a/src/libs/project/Project.ts +++ b/src/libs/project/Project.ts @@ -39,9 +39,9 @@ export class Project implements AsyncDisposable { this.usingProjectOutputFolderKey = `usingProjectFolder-${this.name}` fileSystem.watch(this.path) - fileSystem.ingorePath(join(this.path, '.git')) - fileSystem.ingorePath(join(this.path, '.bridge/.dash.development.json')) - fileSystem.ingorePath(join(this.path, 'builds/')) + fileSystem.ignorePath(join(this.path, '.git')) + fileSystem.ignorePath(join(this.path, '.bridge/.dash.development.json')) + fileSystem.ignorePath(join(this.path, 'builds/')) if (!(this.outputFileSystem instanceof LocalFileSystem)) return diff --git a/src/libs/project/ProjectManager.ts b/src/libs/project/ProjectManager.ts index 22facfc3e..6f3a91bec 100644 --- a/src/libs/project/ProjectManager.ts +++ b/src/libs/project/ProjectManager.ts @@ -96,14 +96,16 @@ export class ProjectManager { } public static async createProject(config: CreateProjectConfig, fileSystem: BaseFileSystem) { + //Bandaid Fix. + const projectPath = join('projects', config.name) + if(await fileSystem.exists(projectPath)) throw new Error("Cannot create project! Another project with the same name already exists!") + const packDefinitions: { id: string; defaultPackPath: string }[] = await Data.get('packages/minecraftBedrock/packDefinitions.json') packDefinitions.push({ id: 'bridge', defaultPackPath: '.bridge', }) - const projectPath = join('projects', config.name) - await fileSystem.makeDirectory(projectPath) await Promise.all(