Push dev work to master #2

Merged
sixteenmillimeter merged 416 commits from dev into master 2018-07-19 15:29:02 +00:00
1 changed files with 11 additions and 9 deletions
Showing only changes of commit 7e58ac40aa - Show all commits

View File

@ -83,24 +83,26 @@ class Wifi {
*/ */
_readConfigCb (err, data) { _readConfigCb (err, data) {
let parsed let parsed
let current
if (err) { if (err) {
console.error(err) console.error(err)
return _cb(err) return _cb(err)
} }
console.log(data)
parsed = parseConfig(data) parsed = parseConfig(data)
console.dir(parsed) console.dir(parsed)
console.log(data) current = parsed.filter(network => {
console.log(data.search(networkPattern)) return (network.ssid + '').toLowerCase() === (_ssid + '').toLowerCase()
console.log(_entry) })
console.log(current)
if (data.search(networkPattern) === -1) { if (typeof current !== 'undefined') {
data += `\n${_entry}` data = data.replace(current.raw, _entry)
} else { } else {
data = data.replace(networkPattern, _entry) data += '\n\n' + _entry
} }
console.dir(data) console.log(data)
_entry = null _entry = null
this._writeConfigCb(null)
//fs.writeFile(filePath, data, 'utf8', this._writeConfigCb) //fs.writeFile(filePath, data, 'utf8', this._writeConfigCb)
} }
/** /**