mirror of
https://github.com/gitbutlerapp/gitbutler.git
synced 2024-11-22 02:34:33 +03:00
Stop users from adding project paths that won't work
This commit is contained in:
parent
4e68e593e5
commit
eece290edd
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user