Beispiel #1
0
// MW-2008-03-18: [[ Bug 3300 ]] Make sure that if a file has a full path we dont' prepend
//   the selected folder.
// MW-2008-03-18: [[ Bug 6116 ]] Make sure that we don't add an extra slash if there's already
//   one at the end of the folder path.
static void build_path(MCExecPoint& ep, const char *p_folder, const MCString& p_file)
{
	char *t_std_file;
	t_std_file = p_file . clone();
	MCU_path2std(t_std_file);

	bool t_use_folder;
	if (p_folder == NULL || strlen(p_folder) == 0 ||
		(strlen(t_std_file) > 1 && t_std_file[1] == ':') ||
		(strlen(t_std_file) > 2 && t_std_file[0] == '/' && t_std_file[1] == '/'))
		t_use_folder = false;
	else
		t_use_folder = true;

	if (t_use_folder)
	{
		ep.appendcstring(p_folder);
		if (p_folder[strlen(p_folder) - 1] != '/')
			ep.appendchar('/');
	}

	ep . appendcstring(t_std_file);

	delete t_std_file;
}