1
0
mirror of https://github.com/Ylianst/MeshAgent synced 2025-12-15 07:43:50 +00:00

Updated file access, so the db can be queried while an agent is still active

This commit is contained in:
Bryan Roe
2019-02-25 21:43:48 -08:00
parent 683852f70a
commit 382ea03135
4 changed files with 77 additions and 18 deletions

View File

@@ -16,13 +16,29 @@ limitations under the License.
var db;
var readonlyDb = true;
if (process.argv.length > 1)
{
switch (process.argv[1])
{
case 'compact':
case 'put':
case 'putx':
case 'delete':
case 'import':
readonlyDb = false;
break;
}
}
if (process.platform == 'win32')
{
db = require('SimpleDataStore').Create(process.execPath.replace('.exe', '.db'));
db = require('SimpleDataStore').Create(process.execPath.replace('.exe', '.db'), { readOnly: readonlyDb });
}
else
{
db = require('SimpleDataStore').Create(process.execPath + '.db');
db = require('SimpleDataStore').Create(process.execPath + '.db', { readOnly: readonlyDb });
}