fix: log and show toast (#4965)

This commit is contained in:
Nico Domino 2024-09-24 16:03:02 +02:00 committed by GitHub
parent 3bed869ded
commit a7325e4d2d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -158,25 +158,21 @@ export class ProjectService {
return path;
}
validateProjectPath(path: string, showErrors = true) {
validateProjectPath(path: string) {
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'
);
}
const errorMsg =
'For WSL2 projects, install the Linux version of GitButler inside of your WSL2 distro';
console.error(errorMsg);
showError('Use the Linux version of GitButler', errorMsg);
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'
);
}
const errorMsg =
'Using git across a network is not recommended. Either clone the repo locally, or use the NET USE command to map a network drive';
console.error(errorMsg);
showError('UNC Paths are not directly supported', errorMsg);
return false;
}