diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..50ca329f2 --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.sh eol=lf diff --git a/app/.prettierrc b/app/.prettierrc index 8bc6e8640..22dbf47c8 100644 --- a/app/.prettierrc +++ b/app/.prettierrc @@ -4,5 +4,6 @@ "trailingComma": "none", "printWidth": 100, "plugins": ["prettier-plugin-svelte", "prettier-plugin-tailwindcss"], - "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }] + "overrides": [{ "files": "*.svelte", "options": { "parser": "svelte" } }], + "endOfLine": "auto" } diff --git a/app/src/lib/backend/projects.ts b/app/src/lib/backend/projects.ts index a871e3c3c..6746bf771 100644 --- a/app/src/lib/backend/projects.ts +++ b/app/src/lib/backend/projects.ts @@ -107,6 +107,8 @@ export class ProjectService { const path = await this.promptForDirectory(); if (!path) return; + if (!this.validateProjectPath(path)) return; + try { const project = await this.add(path); if (!project) return; @@ -118,6 +120,32 @@ export class ProjectService { } } + validateProjectPath(path: string, showErrors = true) { + if (/^\\\\wsl.localhost/i.test(path)) { + if (showErrors) { + showError( + 'Use the Linux version of GitButler', + 'For WSL2 projects, install the Linux version of GitButler inside of your WSL2 distro' + ); + } + + return false; + } + + if (/^\\\\/i.test(path)) { + if (showErrors) { + showError( + 'UNC Paths are not directly supported', + 'Using git across a network is not recommended. Either clone the repo locally, or use the NET USE command to map a network drive' + ); + } + + return false; + } + + return true; + } + getLastOpenedProject() { return get(this.persistedId); }