Machine Learning - Bug fixes (#10377)

* Fixing ML extension bugs
This commit is contained in:
Leila Lali
2020-05-14 12:46:47 -07:00
committed by GitHub
parent d3e1675fc5
commit 0258b1727a
22 changed files with 382 additions and 126 deletions

View File

@@ -44,6 +44,15 @@ export async function exists(path: string): Promise<boolean> {
return promisify(fs.exists)(path);
}
export async function isDirectory(path: string): Promise<boolean> {
try {
const stat = await fs.promises.lstat(path);
return stat.isDirectory();
} catch {
return false;
}
}
export async function createFolder(dirPath: string): Promise<void> {
let folderExists = await exists(dirPath);
if (!folderExists) {
@@ -259,3 +268,18 @@ export function getFileName(filePath: string) {
return '';
}
}
export function getDefaultPythonLocation(): string {
return path.join(getUserHome() || '', 'azuredatastudio-python',
constants.adsPythonBundleVersion,
getPythonExeName());
}
export function getPythonExeName(): string {
return process.platform === constants.winPlatform ? 'python.exe' : 'bin/python3';
}
export function getUserHome(): string | undefined {
return process.env.HOME || process.env.USERPROFILE;
}