mirror of
https://github.com/finos/SymphonyElectron.git
synced 2024-12-27 17:31:36 -06:00
refactor to be more readable (#65)
This commit is contained in:
parent
db6736491c
commit
a9bcb275b1
@ -25,18 +25,24 @@ var symphonyRegistryHKLM6432 = new Registry({
|
||||
var getRegistry = function (name) {
|
||||
var promise = new Promise(function(resolve, reject) {
|
||||
if (isMac) {
|
||||
reject('Mac OS. Using default url from config.json.');
|
||||
} else{
|
||||
reject('registry is not supported for mac osx.');
|
||||
return;
|
||||
}
|
||||
|
||||
//Try to get registry on HKEY_CURRENT_USER
|
||||
symphonyRegistryHKCU.get( name, function( err1, reg1 ) {
|
||||
if (!err1 && reg1 !==null && reg1.value) {
|
||||
resolve(reg1.value);
|
||||
} else{
|
||||
return;
|
||||
}
|
||||
|
||||
//Try to get registry on HKEY_LOCAL_MACHINE
|
||||
symphonyRegistryHKLM.get( name, function( err2, reg2 ) {
|
||||
if ( !err2 && reg2!==null && reg2.value) {
|
||||
resolve(reg2.value);
|
||||
} else{
|
||||
return;
|
||||
}
|
||||
|
||||
// Try to get registry on HKEY_LOCAL_MACHINE in case 32bit app installed on 64bit system.
|
||||
// winreg does not merge keys as normally windows does.
|
||||
symphonyRegistryHKLM6432.get( name, function( err3, reg3 ) {
|
||||
@ -46,12 +52,10 @@ var getRegistry = function (name) {
|
||||
reject('Cannot find PodUrl Registry. Using default url.');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return promise;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user