本文整理汇总了C++中inode_state::set_cwd方法的典型用法代码示例。如果您正苦于以下问题:C++ inode_state::set_cwd方法的具体用法?C++ inode_state::set_cwd怎么用?C++ inode_state::set_cwd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类inode_state
的用法示例。
在下文中一共展示了inode_state::set_cwd方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: fn_ls
//DONEDONEDONEDONEDONEDONEDONE///////////////////////////////////////
void fn_ls (inode_state& state, const wordvec& words){
bool r = false;
string orig = pathname(state.get_contents().at("."),
state.get_root()->get_inode_nr());
if (words.size() > 1) {
for(auto word = words.begin()+1; word != words.end(); word++) {
if((*word)[0] == '/') r = true;
state.set_cwd(split(*word,"/"), r);
print_dir(state);
state.set_cwd(split(orig,"/"),true);
}
}
else
print_dir(state);
DEBUGF ('c', state);
DEBUGF ('c', words);
}
示例2: fn_cd
void fn_cd (inode_state& state, const wordvec& words){
DEBUGF ('c', state);
DEBUGF ('c', words);
if(words.size() > 2)
throw yshell_exn("Too many operands");
inode_ptr cwd = state.get_cwd();
state.set_cwd(cwd, words[1]);
if(words[1] == "..")
{state.directory_path_name.pop_back();}
else if (state.directory_path_name.size() > 1)
{state.directory_path_name.push_back("/"+words[1]);}
else if (state.directory_path_name.size() == 1)
{state.directory_path_name.push_back(words[1]);}
}