Created
January 8, 2020 20:36
-
-
Save bfitzpat/2258562281dbba07f66c32899f113916 to your computer and use it in GitHub Desktop.
getCurrentFolder v1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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