Commit e2e754cf authored by Vincent Michel's avatar Vincent Michel
Browse files

Fix the file API

parent 825b9881
Pipeline #944 passed with stages
in 1 minute and 17 seconds
...@@ -46,8 +46,8 @@ def to_buffer_id(bid): ...@@ -46,8 +46,8 @@ def to_buffer_id(bid):
# Initializing handel # Initializing handel
def init(filename): def init(*path):
filename = to_bytes(filename) filename = to_bytes(os.path.join(*path))
code = handel.xiaInit(filename) code = handel.xiaInit(filename)
check_error(code) check_error(code)
...@@ -172,14 +172,14 @@ def buffer_done(channel, buffer_id): ...@@ -172,14 +172,14 @@ def buffer_done(channel, buffer_id):
# System # System
def load_system(filename): def load_system(*path):
filename = to_bytes(filename) filename = to_bytes(os.path.join(*path))
code = handel.xiaLoadSystem(b'handel_ini', filename) code = handel.xiaLoadSystem(b'handel_ini', filename)
check_error(code) check_error(code)
def save_system(filename): def save_system(*path):
filename = to_bytes(filename) filename = to_bytes(os.path.join(*path))
code = handel.xiaSaveSystem(b'handel_ini', filename) code = handel.xiaSaveSystem(b'handel_ini', filename)
check_error(code) check_error(code)
...@@ -409,7 +409,8 @@ def get_handel_version(): ...@@ -409,7 +409,8 @@ def get_handel_version():
def get_config_files(path): def get_config_files(path):
"""Return all the ini files in path (including subdirectories).""" """Return all the ini files in path (including subdirectories)."""
ext = b'.ini' if isinstance(path, bytes) else '.ini' ext = b'.ini' if isinstance(path, bytes) else '.ini'
return [os.path.join(dp, f).lstrip(path).lstrip('/') sep = b'/' if isinstance(path, bytes) else '/'
return [os.path.join(dp, f).lstrip(path).lstrip(sep)
for dp, dn, fn in os.walk(path) for dp, dn, fn in os.walk(path)
for f in fn for f in fn
if f.endswith(ext)] if f.endswith(ext)]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment