16 from os.path
import join, expanduser, isdir
21 A class for providing access to the mycroft FS sandbox. Intended to be 22 attached to skills at initialization time to provide a skill-specific 31 if not isinstance(path, str)
or len(path) == 0:
32 raise ValueError(
"path must be initialized as a non empty string")
33 path = join(expanduser(
'~'),
'.mycroft', path)
39 def open(self, filename, mode):
41 Get a handle to a file (with the provided mode) within the 42 skill-specific namespace. 44 :param filename: a str representing a path relative to the namespace. 45 subdirs not currently supported. 47 :param mode: a file handle mode 49 :return: an open file handle. 51 file_path = join(self.
path, filename)
52 return open(file_path, mode)
55 return os.path.exists(join(self.
path, filename))
def exists(self, filename)
def open(self, filename, mode)