use native dialog for git clone

fixes #48492
This commit is contained in:
Joao Moreno
2018-04-26 11:33:16 +02:00
parent f765117b95
commit d1380912cf

View File

@@ -348,15 +348,18 @@ export class CommandCenter {
}
const config = workspace.getConfiguration('git');
let value = config.get<string>('defaultCloneDirectory') || os.homedir();
let defaultCloneDirectory = config.get<string>('defaultCloneDirectory') || os.homedir();
defaultCloneDirectory = defaultCloneDirectory.replace(/^~/, os.homedir());
const parentPath = await window.showInputBox({
prompt: localize('parent', "Parent Directory"),
value,
ignoreFocusOut: true
const uris = await window.showOpenDialog({
canSelectFiles: false,
canSelectFolders: true,
canSelectMany: false,
defaultUri: Uri.file(defaultCloneDirectory),
openLabel: localize('selectFolder', "Select Repository Location")
});
if (!parentPath) {
if (!uris || uris.length === 0) {
/* __GDPR__
"clone" : {
"outcome" : { "classification": "SystemMetaData", "purpose": "FeatureInsight" }
@@ -366,6 +369,9 @@ export class CommandCenter {
return;
}
const uri = uris[0];
const parentPath = uri.fsPath;
try {
const opts = {
location: ProgressLocation.Notification,
@@ -375,7 +381,7 @@ export class CommandCenter {
const repositoryPath = await window.withProgress(
opts,
(_, token) => this.git.clone(url!, parentPath.replace(/^~/, os.homedir()), token)
(_, token) => this.git.clone(url!, parentPath, token)
);
const choices = [];