Exemple #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;

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

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

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

}
Exemple #5
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;
};
Exemple #6
0
bool ChangeDir::Action()
{
	Cmd* cmd = Cmd::Instance();
	
	if (!GetParams()->empty())
	{
		Fs::Path path = GetParams()->front();
		Fs::Object* obj = cmd->GetCurrentPath();
		
		obj = cmd->GetWorkPath(&path);
		
		if (obj)
			cmd->SetCurrentPath(obj);
	}
	
	return true;

}
Exemple #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;

}