Support tilda in data_dir

pull/1592/head
Matthew D. Scholefield 2018-05-23 15:03:01 -05:00
parent b0b88bbd62
commit 509162de50
7 changed files with 16 additions and 11 deletions

View File

@ -83,6 +83,8 @@
"offset": -21600000
}
},
// Also change in scripts/prepare-msm.sh
"data_dir": "/opt/mycroft",
// General skill values

View File

@ -16,7 +16,7 @@ import json
import time
from threading import Thread
from os.path import isfile, join
from os.path import isfile, join, expanduser
from mycroft.configuration import Configuration
from mycroft.messagebus.message import Message
@ -52,7 +52,7 @@ class EventScheduler(Thread):
schedule_file: File to store pending events to on shutdown
"""
super(EventScheduler, self).__init__()
data_dir = Configuration.get()['data_dir']
data_dir = expanduser(Configuration.get()['data_dir'])
self.events = {}
self.emitter = emitter

View File

@ -229,8 +229,9 @@ class SkillManager(Thread):
config = Configuration.get()
msm_config = config['skills']['msm']
repo_config = msm_config['repo']
skills_dir = join(config['data_dir'], msm_config['directory'])
repo_cache = join(config['data_dir'], repo_config['cache'])
data_dir = expanduser(config['data_dir'])
skills_dir = join(data_dir, msm_config['directory'])
repo_cache = join(data_dir, repo_config['cache'])
platform = config['enclosure'].get('platform', 'default')
return MycroftSkillsManager(
platform=platform, skills_dir=skills_dir,

View File

@ -19,7 +19,7 @@ from threading import Thread
from time import time, sleep
import os.path
from os.path import exists, join
from os.path import exists, join, expanduser
from mycroft import MYCROFT_ROOT_PATH
from mycroft.api import DeviceApi
@ -29,7 +29,7 @@ from mycroft.util.download import download
from mycroft.util.log import LOG
config = Configuration.get().get("tts").get("mimic")
data_dir = Configuration.get()['data_dir']
data_dir = expanduser(Configuration.get()['data_dir'])
BIN = config.get("path",
os.path.join(MYCROFT_ROOT_PATH, 'mimic', 'bin', 'mimic'))

View File

@ -15,7 +15,7 @@
from __future__ import absolute_import
import socket
import subprocess
from os.path import join
from os.path import join, expanduser
from threading import Thread
from time import sleep
@ -73,7 +73,8 @@ def resolve_resource_file(res_name):
return filename
# Next look for /opt/mycroft/res/res_name
filename = os.path.expanduser(join(config['data_dir'], res_name))
data_dir = expanduser(config['data_dir'])
filename = os.path.expanduser(join(data_dir, res_name))
if os.path.isfile(filename):
return filename

View File

@ -15,7 +15,7 @@
import json
from genericpath import exists, isfile
from os.path import join
from os.path import join, expanduser
from mycroft.configuration import Configuration
from mycroft.util.log import LOG
@ -37,7 +37,8 @@ CORE_VERSION_STR = '.'.join(map(str, CORE_VERSION_TUPLE))
class VersionManager(object):
@staticmethod
def get():
version_file = join(Configuration.get()['data_dir'], 'version.json')
data_dir = expanduser(Configuration.get()['data_dir'])
version_file = join(data_dir, 'version.json')
if exists(version_file) and isfile(version_file):
try:
with open(version_file) as f:

View File

@ -14,7 +14,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
mycroft_root_dir='/opt/mycroft'
mycroft_root_dir='/opt/mycroft' # Also change in configuration
skills_dir="${mycroft_root_dir}"/skills
# exit on any error
set -Ee