コード例 #1
0
ファイル: builtin_cd.c プロジェクト: abellion/SH1
int		builtin_cd(char **args, t_list **env)
{
	char	*input;
	char	*options;
	char	*path;
	char	*old_path;

	options = options_formater(args);
	input = args_input(&args[1]);
	if (cd_errors(options, input) != 1)
		return (-1);
	path = determine_path(input, *env);
	old_path = get_from_env_lst("PWD", *env);
	if (ft_strlen(path) && chdir(path) == 0)
	{
		path = (ft_strchr(options, 'P')) ? cd_option_p(path) : path;
		*env = env_set("PWD", path, *env);
		*env = env_set("OLDPWD", old_path, *env);
	}
	return (1);
}
コード例 #2
0
stereo_task create_from_storage(const storage_type& fs, const std::string& base_pathname = "")
{
	std::string name;
	int dispRange, groundSubsampling;

	fs["dispRange"] >> dispRange;
	fs["groundTruthSubsampling"] >> groundSubsampling;
	fs["name"] >> name;

	boost::filesystem::path base_path = base_pathname;

	std::string left  = determine_path(fs, "left",  base_path);
	std::string right = determine_path(fs, "right", base_path);
	std::string leftGround  = determine_path(fs, "groundLeft",  base_path);
	std::string rightGround = determine_path(fs, "groundRight", base_path);
	std::string leftOcc  = determine_path(fs, "occLeft",  base_path);
	std::string rightOcc = determine_path(fs, "occRight", base_path);

	return stereo_task(name, left, right, leftGround, rightGround, leftOcc, rightOcc, groundSubsampling, dispRange);
}