Example #1
0
    virtual int make_directory(entry_t& entry, const path_t& path) {
        const char_t* chars = 0;
        size_t length = 0;
        int err = 1;

        if ((chars = path.directory().chars(length)) && (0 < length)) {
            const char_t* dchars = chars;
            size_t dlength = length;
            sub_directories_t sub_directories;

            EV_LOG_MESSAGE_INFO("make directory \"" << chars << "\"...");
            for (bool exists = false; !exists; ) {
                string_t directory(dchars, dlength);

                EV_LOG_MESSAGE_INFO("directory \"" << directory.chars() << "\" exists?...");
                if (!(exists = entry.exists(directory.chars()))) {
                    sub_directory_t sub_directory(dchars, dlength);

                    EV_LOG_MESSAGE_INFO("...directory \"" << directory.chars() << "\" does not exist");
                    sub_directories.push_front(sub_directory);
                    if ((dchars = parent_directory(dchars, dlength, path))) {
                        continue;
                    }
                } else {
                    EV_LOG_MESSAGE_INFO("...directory \"" << directory.chars() << "\" exists");
                }
                break;
            }
            err = make_directories(sub_directories, entry, path);
        }
        return err;
    }
Example #2
0
std::string fs_t::join(const std::string& path,const std::string& sub) const {
	if(_starts_with(sub,pimpl->data_directory))
		return canocial(sub);
	const char* s = sub.c_str();
	while((*s=='\\')||(*s=='/')) s++;
	if(is_dir(path))
		return canocial(path+'/'+s);
	return canocial(parent_directory(path)+'/'+s);
}
Example #3
0
	void move_up_a_level()
	{
		string base;
		string part;
		current_directory.SplitPath(base, part);
		if(part != string())
		{
			FileSpecifier parent_directory(base);
			if(parent_directory.Exists())
			{
				current_directory = parent_directory;
				refresh_entries();
				select_entry(part, true);
				announce_directory_changed();
			}
		}
	}