mirror of
https://github.com/ckaczor/azuredatastudio.git
synced 2026-02-03 17:23:42 -05:00
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user