Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private async handleImport(data: IEclipseIPCData) {
if (!path.isAbsolute(data.toFolder)) {
vscode.window.showErrorMessage('Can only extract to absolute path');
return;
}
const oldProjectPath = path.dirname(data.fromProps);
const cpp = await existsAsync(path.join(oldProjectPath, '.cproject'));
// tslint:disable-next-line:no-unsafe-any
const values = javaProperties.of(data.fromProps);
// tslint:disable-next-line:no-unsafe-any
const javaPackageRobotClass: string = values.get('robot.class', '');
// tslint:disable-next-line:no-unsafe-any
const javaRobotPackage: string = values.get('package', '');
const javaRobotClass = javaPackageRobotClass.substr(javaRobotPackage.length + 1);
let toFolder = data.toFolder;
if (data.newFolder) {
toFolder = path.join(data.toFolder, data.projectName);
}
try {
export async function importProjectButtonClick() {
(document.activeElement as HTMLElement).blur();
const data: IImportProject = {
fromProps: (document.getElementById('eclipseInput') as HTMLInputElement).value,
newFolder: (document.getElementById('newFolderCB') as HTMLInputElement).checked,
projectName: (document.getElementById('projectName') as HTMLInputElement).value,
teamNumber: (document.getElementById('teamNumber') as HTMLInputElement).value,
toFolder: (document.getElementById('projectFolder') as HTMLInputElement).value,
};
const oldProjectPath = path.dirname(data.fromProps);
const cpp = await existsAsync(path.join(oldProjectPath, '.cproject'));
// tslint:disable-next-line:no-unsafe-any
const values = javaProperties.of(data.fromProps);
// tslint:disable-next-line:no-unsafe-any
const javaRobotClass: string = values.get('robot.class', '');
let toFolder = data.toFolder;
if (data.newFolder) {
toFolder = path.join(data.toFolder, data.projectName);
}
try {
await mkdirpAsync(toFolder);
} catch {
//
}
readConfig: function (path) {
try {
var values = properties.of(path);
return values.objs;
} catch (e) {
console.log('Could not read config file', e);
return {};
}
},
const safeReadProperties = filePath => {
try {
return javaProperties.of(filePath);
} catch (_) {
return undefined;
}
};
return (async (options) => {
options = _$assign({}, options)
const defaultOptions = {
environment: '',
host: 'localhost',
password: 'admin',
port: 1717,
username: 'admin'
}
if (_$isString(options.prefs)) {
options.prefs = path.resolve(options.prefs)
const preferencesFileProperties = javaProperties.of(options.prefs)
delete options.prefs
const preferencesFileOptions = {
environment: preferencesFileProperties.get('environment'),
host: preferencesFileProperties.get('host'),
password: preferencesFileProperties.get('password'),
port: preferencesFileProperties.getInt('port'),
username: preferencesFileProperties.get('username')
}
_$forEach(defaultOptions, (defaultOptionValue, optionKey) => {
if (_$isUndefined(options[optionKey])) {
options[optionKey] = (! _$isUndefined(preferencesFileOptions[optionKey])) ? preferencesFileOptions[optionKey] : defaultOptionValue
}
})
} else {
_$forEach(defaultOptions, (defaultOptionValue, optionKey) => {
options[optionKey] = (! _$isUndefined(options[optionKey])) ? options[optionKey] : defaultOptionValue