Skip to content

Commit f80496d

Browse files
committed
revert paths.ts defaults
1 parent ecd39ef commit f80496d

1 file changed

Lines changed: 4 additions & 31 deletions

File tree

src/vs/base/node/paths.ts

Lines changed: 4 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,40 +4,13 @@
44
*--------------------------------------------------------------------------------------------*/
55

66
import uri from 'vs/base/common/uri';
7-
import * as path from 'path';
8-
import * as os from 'os';
97

108
interface IPaths {
119
getAppDataPath(platform: string): string;
1210
getUserDataPath(platform: string, appName: string, args: string[]): string;
1311
}
1412

15-
function defaultGetAppDataPath(platform) {
16-
switch (platform) {
17-
case 'win32': return process.env['APPDATA'];
18-
case 'darwin': return path.join(os.homedir(), 'Library', 'Application Support');
19-
case 'linux': return process.env['XDG_CONFIG_HOME'] || path.join(os.homedir(), '.config');
20-
default: throw new Error('Platform not supported');
21-
}
22-
}
23-
24-
function defaultGetUserDataPath(platform, appName) {
25-
return path.join(getAppDataPath(platform), appName);
26-
}
27-
28-
let _getAppDataPath: (platform: string) => string;
29-
let _getUserDataPath: (platform: string, appName: string, args: string[]) => string;
30-
31-
try {
32-
const pathsPath = uri.parse(require.toUrl('paths')).fsPath;
33-
const paths = require.__$__nodeRequire<IPaths>(pathsPath);
34-
35-
_getAppDataPath = paths.getAppDataPath;
36-
_getUserDataPath = paths.getUserDataPath;
37-
} catch (error) {
38-
_getAppDataPath = (platform) => defaultGetAppDataPath(platform);
39-
_getUserDataPath = (platform: string, appName: string, args: string[]) => defaultGetUserDataPath(platform, appName);
40-
}
41-
42-
export const getAppDataPath = _getAppDataPath;
43-
export const getUserDataPath = _getUserDataPath;
13+
const pathsPath = uri.parse(require.toUrl('paths')).fsPath;
14+
const paths = require.__$__nodeRequire<IPaths>(pathsPath);
15+
export const getAppDataPath = paths.getAppDataPath;
16+
export const getUserDataPath = paths.getUserDataPath;

0 commit comments

Comments
 (0)