diff --git a/common/src/session.cpp b/common/src/session.cpp index bc1643b..08e7cf5 100644 --- a/common/src/session.cpp +++ b/common/src/session.cpp @@ -118,8 +118,19 @@ std::string Session::write_file(const std::string& path, const std::string& cont std::string Session::read_file(const std::string& path) { vfs_node* root = get_session_machine()->vfs_root; - vfs_node* node = find_node_by_path(root, path); - if(node && node->type == FILE_NODE) { + vfs_node* node = nullptr; + + if(path[0] == '/') { + node = find_node_by_path(root, path); + } else { + /* Relative path. */ + vfs_node* current_dir = get_current_dir(); + if(current_dir->children.count(path)) { + node = current_dir->children.at(path); + } + } + + if(node && (node->type == FILE_NODE || node->type == EXEC_NODE)) { return node->content; } return "Error: file not found.";