mirror of
https://github.com/MoreTore/openpilot.git
synced 2026-08-05 08:16:06 +08:00
manager runs on Mac, and other openpilot for PC fixes (#1037)
* use the openpilot/persist directory on PC * manager runs on mac * sim runs w/o carla * fix params location in test * that rmtree can fail and it's okay * refactor params clear functionality * set PARAMS_PATH
This commit is contained in:
+7
-2
@@ -29,7 +29,7 @@ import fcntl
|
||||
import tempfile
|
||||
import threading
|
||||
from enum import Enum
|
||||
|
||||
from common.basedir import PARAMS
|
||||
|
||||
def mkdirs_exists_ok(path):
|
||||
try:
|
||||
@@ -320,7 +320,7 @@ def write_db(params_path, key, value):
|
||||
lock.release()
|
||||
|
||||
class Params():
|
||||
def __init__(self, db='/data/params'):
|
||||
def __init__(self, db=PARAMS):
|
||||
self.db = db
|
||||
|
||||
# create the database if it doesn't exist...
|
||||
@@ -328,6 +328,11 @@ class Params():
|
||||
with self.transaction(write=True):
|
||||
pass
|
||||
|
||||
def clear_all(self):
|
||||
shutil.rmtree(self.db, ignore_errors=True)
|
||||
with self.transaction(write=True):
|
||||
pass
|
||||
|
||||
def transaction(self, write=False):
|
||||
if write:
|
||||
return DBWriter(self.db)
|
||||
|
||||
Reference in New Issue
Block a user