forked from microsoft/rushstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRushGlobalFolder.ts
More file actions
39 lines (34 loc) · 1.34 KB
/
RushGlobalFolder.ts
File metadata and controls
39 lines (34 loc) · 1.34 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license.
// See LICENSE in the project root for license information.
import * as path from 'path';
import { Utilities } from '../utilities/Utilities';
/**
* This class provides global folders that are used for rush's internal install locations.
*
* @internal
*/
export class RushGlobalFolder {
private _rushUserFolder: string;
private _rushNodeSpecificUserFolder: string;
/**
* The absolute path to Rush's storage in the home directory for the current user, independent of node version.
* On Windows, it would be something like `C:\Users\YourName\.rush\`.
*/
public get path(): string {
return this._rushUserFolder;
}
/**
* The absolute path to Rush's storage in the home directory for the current user and node version.
* On Windows, it would be something like `C:\Users\YourName\.rush\node-v3.4.5`.
*/
public get nodeSpecificPath(): string {
return this._rushNodeSpecificUserFolder;
}
public constructor() {
this._rushUserFolder = path.join(Utilities.getHomeDirectory(), '.rush');
const normalizedNodeVersion: string = process.version.match(/^[a-z0-9\-\.]+$/i)
? process.version
: 'unknown-version';
this._rushNodeSpecificUserFolder = path.join(this._rushUserFolder, `node-${normalizedNodeVersion}`);
}
}