mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2025-12-18 21:53:22 +00:00
* Fixes radar issues (#80453) ## About The Pull Request Went through tgui:sonar to search for bugs. Some of these are valid - they've been addressed. Others, not so. Telling me I need to make icon names and css classes into constants is a nit at best. Radar seems to be bugged in certain areas: Classnames ok to dupe, but not ones with conditionals. Most of the function duplication errors rely on hooks. I think this should close #79815 and we should remove radar shortly after. See my comment [here](https://github.com/tgstation/tgstation/issues/79815#issuecomment-1859286784) ## Why It's Good For The Game Fixes #79815 ## Changelog N/A none of this was player facing * Fixes radar issues --------- Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
46 lines
1.2 KiB
JavaScript
46 lines
1.2 KiB
JavaScript
/**
|
|
* Tools for dealing with Windows Registry bullshit.
|
|
*
|
|
* @file
|
|
* @copyright 2020 Aleksej Komarov
|
|
* @license MIT
|
|
*/
|
|
|
|
import { exec } from 'child_process';
|
|
import { promisify } from 'util';
|
|
|
|
import { createLogger } from './logging.js';
|
|
|
|
const logger = createLogger('winreg');
|
|
|
|
export const regQuery = async (path, key) => {
|
|
if (process.platform !== 'win32') {
|
|
return null;
|
|
}
|
|
try {
|
|
const command = `reg query "${path}" /v ${key}`;
|
|
const { stdout } = await promisify(exec)(command);
|
|
const keyPattern = ` ${key} `;
|
|
const indexOfKey = stdout.indexOf(keyPattern);
|
|
if (indexOfKey === -1) {
|
|
logger.error('could not find the registry key');
|
|
return null;
|
|
}
|
|
const indexOfEol = stdout.indexOf('\r\n', indexOfKey);
|
|
if (indexOfEol === -1) {
|
|
logger.error('could not find the end of the line');
|
|
return null;
|
|
}
|
|
const indexOfValue = stdout.indexOf(' ', indexOfKey + keyPattern.length);
|
|
if (indexOfValue === -1) {
|
|
logger.error('could not find the start of the key value');
|
|
return null;
|
|
}
|
|
|
|
return stdout.substring(indexOfValue + 4, indexOfEol);
|
|
} catch (err) {
|
|
logger.error(err);
|
|
return null;
|
|
}
|
|
};
|