Ignore line endings when comparing config file against default (#3645)

This commit is contained in:
Juan Campa 2019-05-09 18:31:11 +00:00 committed by GitHub
parent efeedd0a9d
commit 6a05b7307c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,7 +55,10 @@ const migrateHyper2Config = () => {
return; return;
} }
const hasNewConfigBeenTouched = existsNew && readFileSync(cfgPath, 'utf8') !== readFileSync(defaultCfg, 'utf8'); if (existsNew) {
const cfg1 = readFileSync(defaultCfg, 'utf8').replace(/\r|\n/g, '');
const cfg2 = readFileSync(cfgPath, 'utf8').replace(/\r|\n/g, '');
const hasNewConfigBeenTouched = cfg1 !== cfg2;
if (hasNewConfigBeenTouched) { if (hasNewConfigBeenTouched) {
// Assume the user has migrated manually but rename old config to .backup so // Assume the user has migrated manually but rename old config to .backup so
// we don't keep trying to migrate on every launch // we don't keep trying to migrate on every launch
@ -66,6 +69,7 @@ const migrateHyper2Config = () => {
); );
return; return;
} }
}
// Migrate // Migrate
copySync(legacyCfgPath, cfgPath); copySync(legacyCfgPath, cfgPath);