Exemple #1
0
const char* scan_dir::next_dir(bool full /* = false */)
{
	if (scan_ == NULL)
		return NULL;

	const char* dir = acl_scan_dir_next_dir(scan_);
	if (dir == NULL || *dir == 0)
		return NULL;
	if (!full)
		return dir;

	const char* path = curr_path();
	if (path == NULL)
		return NULL;

	if (file_buf_ == NULL)
		file_buf_ = NEW string(256);

#ifdef	ACL_WINDOWS
	file_buf_->format("%s%c%s", path, PATH_SEP_C, dir);
#else
	if (*path == '/' && *(path + 1) == 0)
		file_buf_->format("%s%s", path, dir);
	else
		file_buf_->format("%s%c%s", path, PATH_SEP_C, dir);
#endif

	return file_buf_->c_str();
}
Exemple #2
0
const char* scan_dir::next(bool full /* = false */, bool* is_file /* = NULL */)
{
	if (scan_ == NULL)
		return NULL;

	int res;
	const char* name = acl_scan_dir_next_name(scan_, &res);
	if (name == NULL || *name == 0)
		return NULL;

	if (is_file)
		*is_file = res ? true : false;
	if (!full)
		return name;

	const char* path = curr_path();
	if (path == NULL)
		return NULL;

	if (file_buf_ == NULL)
		file_buf_ = NEW string(256);


#ifdef	ACL_WINDOWS
	file_buf_->format("%s%c%s", path, PATH_SEP_C, name);
#else
	if (*path == '/' && *(path + 1) == 0)
		file_buf_->format("%s%s", path, name);
	else
		file_buf_->format("%s%c%s", path, PATH_SEP_C, name);
#endif

	return file_buf_->c_str();
}
Exemple #3
0
const char* scan_dir::next_file(bool full /* = false */)
{
	if (scan_ == NULL)
		return NULL;

	const char* file =  acl_scan_dir_next_file(scan_);
	if (file == NULL || *file == 0)
		return NULL;
	if (!full)
		return file;

	const char* path = curr_path();
	if (path == NULL)
		return NULL;

	if (file_buf_ == NULL)
		file_buf_ = NEW string(256);


#ifdef	WIN32
	file_buf_->format("%s%c%s", path, PATH_SEP_C, file);
#else
	if (*path == '/' && *(path + 1) == 0)
		file_buf_->format("%s%s", path, file);
	else
		file_buf_->format("%s%c%s", path, PATH_SEP_C, file);
#endif

	return file_buf_->c_str();
}
Exemple #4
0
const char* scan_dir::curr_file(bool full /* = false */)
{
	if (scan_ == NULL)
		return NULL;
	const char* ptr = acl_scan_dir_file(scan_);
	if (ptr == NULL || *ptr == 0)
		return NULL;
	if (!full)
		return ptr;

	const char* path = curr_path();
	if (path == NULL)
		return NULL;

	if (file_buf_ == NULL)
		file_buf_ = NEW string(256);
	file_buf_->format("%s%c%s", path, PATH_SEP_C, ptr);

	return file_buf_->c_str();
}