Create the azure folder differently. (#7470)

Create the folder with a different mechanism.
This commit is contained in:
Amir Omidi
2019-10-02 12:57:29 -07:00
committed by GitHub
parent b8976785fd
commit 2b8508574d

View File

@@ -84,15 +84,29 @@ export async function activate(context: vscode.ExtensionContext) {
// Create the folder for storing the token caches
async function findOrMakeStoragePath() {
let storagePath = path.join(getDefaultLogLocation(), constants.extensionName);
let defaultLogLocation = getDefaultLogLocation();
let storagePath = path.join(defaultLogLocation, constants.extensionName);
try {
await fs.mkdir(defaultLogLocation, { recursive: true });
} catch (e) {
if (e.code !== 'EEXIST') {
console.log(`Creating the base directory failed... ${e}`);
return undefined;
}
}
try {
await fs.mkdir(storagePath, { recursive: true });
console.log('Initialized Azure account extension storage.');
}
catch (e) {
console.error(`Initialization of Azure account extension storage failed: ${e}`);
console.error('Azure accounts will not be available');
} catch (e) {
if (e.code !== 'EEXIST') {
console.error(`Initialization of Azure account extension storage failed: ${e}`);
console.error('Azure accounts will not be available');
return undefined;
}
}
console.log('Initialized Azure account extension storage.');
return storagePath;
}