Skip to content

Instantly share code, notes, and snippets.

@bfitzpat
Created January 8, 2020 20:36
Show Gist options
  • Select an option

  • Save bfitzpat/2258562281dbba07f66c32899f113916 to your computer and use it in GitHub Desktop.

Select an option

Save bfitzpat/2258562281dbba07f66c32899f113916 to your computer and use it in GitHub Desktop.
getCurrentFolder v1
function getCurrentFolder(): Promise<string> {
return new Promise((resolve, reject) => {
vscode.commands.executeCommand('copyFilePath').then(async () => {
try {
await vscode.env.clipboard.readText().then((copyPath) => {
try {
if (fs.existsSync(copyPath)) {
resolve(copyPath);
return copyPath;
}
} catch (err) {
reject(err);
return undefined;
}
});
} catch (err) {
reject(err);
return undefined;
}
});
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment