Example #1
0
bool MakeDynLink::Action()
{
	if (GetParams()->size() < 2)
	{
		return false;
	}	
    else
	{
		Cmd* cmd = Cmd::Instance();
		Fs::Path path1 = GetParams()->at(0);
		Fs::Path path2 = GetParams()->at(1);

		Fs::Object* obj = cmd->GetWorkPath(&path1);
		if (obj)
		{
			if (!path1.GetFile().empty())
			{
				for (size_t i = 0; i < obj->GetChilds().size(); i++)
				{
					if (cmd->GetFs()->IsFile(obj->GetChilds()[i]) && (obj->GetChilds()[i]->GetName() == path1.GetFile()))
					{
						cmd->GetFs()->MakeDynLink(obj->GetChilds()[i], cmd->GetWorkPath(&path2));
						break;
					}
				}
			}
			else
			{
				cmd->GetFs()->MakeDynLink(obj, cmd->GetWorkPath(&path2));
			}
		}
	}
	return true;

}
Example #2
0
bool Tree::Action()
{
	Cmd* cmd = Cmd::Instance();
	
	Display display;
	display.Tree(cmd->GetFs()->GetRoot(), 0, "|   ");
	return true;

}
Example #3
0
bool DelTree::Action()
{
	if (!GetParams()->empty())
	{
		Cmd* cmd = Cmd::Instance();
		cmd->GetFs()->DelTree(cmd->GetWorkPath(&GetParams()->front()));
	}
	
	return true;

}
Example #4
0
bool RemoveDir::Action()
{
	if (!GetParams()->empty())
	{
		Cmd* cmd = Cmd::Instance();
		cmd->GetFs()->RemoveDir(cmd->GetWorkPath(&GetParams()->front()));
	}
	
	return true;

}
Example #5
0
bool MakeFile::Action()
{
	if (!GetParams()->empty())
	{
		Cmd* cmd = Cmd::Instance();
	
		cmd->GetFs()->MakeFile(cmd->GetWorkPath(&GetParams()->front()), &GetParams()->front());
	}
	
	return true;

}
Example #6
0
bool MakeDir::Action()
{
	if (!GetParams()->empty())
	{
		Cmd* cmd = Cmd::Instance();
		Fs::Path path = GetParams()->at(0);
		
		path.SetFile(path.GetPath()->back());
		path.GetPath()->pop_back();
		
		cmd->GetFs()->MakeDir(cmd->GetWorkPath(&path), &path);
	}
	
	return true;
};
Example #7
0
bool Del::Action()
{
	if (!GetParams()->empty())
	{
		Cmd* cmd = Cmd::Instance();
		Fs::Object* obj = cmd->GetWorkPath(&GetParams()->front());
		
		if (!GetParams()->front().GetFile().empty())
		{
			for (size_t i = 0; i < obj->GetChilds().size(); i++)
			{
				if (obj->GetChilds()[i]->GetName() == GetParams()->front().GetFile())
				{
					cmd->GetFs()->Del(obj->GetChilds()[i]);
					break;
				}
			}
		}
	}
	
	return true;

}