Skip to content

Commit

Permalink
Create ATOMIST_ROOT dir if it doesn't exist
Browse files Browse the repository at this point in the history
fixes #150
  • Loading branch information
cdupuis committed Aug 27, 2018
1 parent 0e85672 commit 68b88c5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/common/configuration/defaultLocalModeConfiguration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* limitations under the License.
*/

import { logger } from "@atomist/automation-client";
import { LocalModeConfiguration } from "@atomist/sdm-core";
import * as os from "os";
import * as path from "path";
import * as fs from "fs-extra";

export function defaultLocalLocalModeConfiguration(): LocalModeConfiguration {
return {
Expand All @@ -29,5 +31,10 @@ export function defaultLocalLocalModeConfiguration(): LocalModeConfiguration {
const DefaultAtomistRoot = "atomist";

export function determineDefaultRepositoryOwnerParentDirectory() {
return process.env.ATOMIST_ROOT || path.join(os.homedir(), DefaultAtomistRoot);
const root = process.env.ATOMIST_ROOT || path.join(os.homedir(), DefaultAtomistRoot);
if (!fs.existsSync(root)) {
logger.info(`Creating Atomist repository owner directory at '${root}'`);
fs.mkdirSync(root, "0744");
}
return root;
}

0 comments on commit 68b88c5

Please sign in to comment.