MCPcopy Index your code
hub / github.com/REditorSupport/vscode-R / getRpathFromSystem

Function getRpathFromSystem

src/util.ts:63–86  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

61}
62
63export async function getRpathFromSystem(): Promise<string> {
64
65 let rpath = '';
66 const platform: string = process.platform;
67
68 rpath ||= getRfromEnvPath(platform);
69
70 if ( !rpath && platform === 'win32') {
71 // Find path from registry
72 try {
73 const key = new winreg({
74 hive: winreg.HKLM,
75 key: '\\Software\\R-Core\\R',
76 });
77 const item: winreg.RegistryItem = await new Promise((c, e) =>
78 key.get('InstallPath', (err, result) => err === null ? c(result) : e(err)));
79 rpath = path.join(item.value, 'bin', 'R.exe');
80 } catch (e) {
81 rpath = '';
82 }
83 }
84
85 return rpath;
86}
87
88export function getRPathConfigEntry(term: boolean = false): string {
89 const trunc = (term ? 'rterm' : 'rpath');

Callers 2

getRpathFunction · 0.85
getRtermFunction · 0.85

Calls 2

getRfromEnvPathFunction · 0.85
getMethod · 0.45

Tested by

no test coverage detected