コード例 #1
0
ファイル: dir.cpp プロジェクト: VictorCPH/fileSystem
int enter_dir(char* name)
{
	int tmp = inode_num;//记录原始inode节点
	char tmpPath[40], nameCopy[30];
	char dst[30][NameLength];

	strcpy(tmpPath, path);
	strcpy(nameCopy, name);
	int cnt = split(dst, nameCopy, "/");
	if (name[0] == '/') {//从根目录开始
		 //printf("1111111111\n");
		close_dir(inode_num);
		inode_num = 0;
		open_dir(inode_num);
		strcpy(path, "monitor@root:");
	}
	for (int i = 0; i < cnt; i++) {
		//printf("%d\n", i);
		int res = enter_child_dir(inode_num, dst[i]);
		change_path(dst[i]);
		if (res == -1) {
			inode_num = tmp;
			open_dir(inode_num);
			strcpy(path, tmpPath);
			return -1;
		}
	}
	return 0;
}
コード例 #2
0
ファイル: path.cpp プロジェクト: whthend/FIleManager_OS
int eat_path(char* name)
{
	int tmp = inode_num;//记录原始inode节点
	char dst[30][NameLength];
	int cnt = split(dst, name, "/");
	if (name[0] == '/') {//从根目录开始
						 //printf("1111111111\n");
		close_dir(inode_num);
		inode_num = 0;
		open_dir(inode_num);
	}
	for (int i = 0; i < cnt - 1; i++) {
		//printf("%d\n", i);
		int res = enter_child_dir(inode_num, dst[i]);
		if (res == -1) {
			inode_num = tmp;
			open_dir(inode_num);
			return -1;
		}
	}
	if (cnt == 0)
		strcpy(name, ".");
	else
		strcpy(name, dst[cnt - 1]);
	return 0;
}
コード例 #3
0
ファイル: fanotify04.c プロジェクト: gibertre/ltp
int main(int ac, char **av)
{
	int lc;
	const char *msg;

	if ((msg = parse_opts(ac, av, NULL, NULL)) != NULL)
		tst_brkm(TBROK, NULL, "OPTION PARSING ERROR - %s", msg);

	setup();

	for (lc = 0; TEST_LOOPING(lc); lc++) {
		/* Check ONLYDIR on a directory */
		CHECK_MARK(".", FAN_MARK_ONLYDIR, 0, NULL);

		/* Check ONLYDIR without a directory */
		CHECK_MARK(fname, FAN_MARK_ONLYDIR, -1, NULL);

		/* Check DONT_FOLLOW for a symlink */
		CHECK_MARK(sname, FAN_MARK_DONT_FOLLOW, 0, test_open_symlink);

		/* Check without DONT_FOLLOW for a symlink */
		CHECK_MARK(sname, 0, 0, test_open_file);

		/* Verify FAN_MARK_FLUSH destroys all inode marks */
		if (myfanotify_mark(fd_notify, FAN_MARK_ADD,
				    FAN_OPEN, AT_FDCWD, fname) < 0) {
			tst_brkm(TBROK | TERRNO, cleanup,
			    "fanotify_mark (%d, FAN_MARK_ADD, FAN_OPEN, "
			    "AT_FDCWD, '%s') failed", fd_notify, fname);
		}
		if (myfanotify_mark(fd_notify, FAN_MARK_ADD,
				    FAN_OPEN | FAN_ONDIR, AT_FDCWD, dir) < 0) {
			tst_brkm(TBROK | TERRNO, cleanup,
			    "fanotify_mark (%d, FAN_MARK_ADD, FAN_OPEN | "
			    "FAN_ONDIR, AT_FDCWD, '%s') failed", fd_notify,
			    dir);
		}
		open_file(fname);
		verify_event(S_IFREG);
		open_dir(dir);
		verify_event(S_IFDIR);
		if (myfanotify_mark(fd_notify, FAN_MARK_FLUSH,
				    0, AT_FDCWD, ".") < 0) {
			tst_brkm(TBROK | TERRNO, cleanup,
			    "fanotify_mark (%d, FAN_MARK_FLUSH, 0, "
			    "AT_FDCWD, '.') failed", fd_notify);
		}

		open_dir(dir);
		verify_no_event();
	}

	cleanup();
	tst_exit();
}
コード例 #4
0
void wildcard_expander_t::expand_trailing_slash(const wcstring &base_dir, const wcstring &prefix) {
    if (interrupted()) {
        return;
    }

    if (!(flags & EXPAND_FOR_COMPLETIONS)) {
        // Trailing slash and not accepting incomplete, e.g. `echo /xyz/`. Insert this file if it
        // exists.
        if (waccess(base_dir, F_OK) == 0) {
            this->add_expansion_result(base_dir);
        }
    } else {
        // Trailing slashes and accepting incomplete, e.g. `echo /xyz/<tab>`. Everything is added.
        DIR *dir = open_dir(base_dir);
        if (dir) {
            wcstring next;
            while (wreaddir(dir, next) && !interrupted()) {
                if (!next.empty() && next.at(0) != L'.') {
                    this->try_add_completion_result(base_dir + next, next, L"", prefix);
                }
            }
            closedir(dir);
        }
    }
}
コード例 #5
0
bool PakFileDialog::Validate()
{
  if( m_selected.empty() )
  {
//    m_infolabel->SetLabel(_("Please select a file"));
    return false; // nothing selected
  }

  if( m_files.find(m_selected) != m_files.end() )
  { // it's a file woohooh
    for( size_t i=0; i < m_exts.Count(); ++i )
    {
      if( m_selected.Matches(wxT("*.") + m_exts[i]) )
        return true;
    }
    // file selected of which we don't accept the extension
    return false; 
  }

  // must be a dir then
  wxASSERT(std::find(m_dirs.begin(), m_dirs.end(), m_selected) != m_dirs.end());
  if( !m_exts.Count() ) // we accept dirs?
    return true;

  open_dir(m_selected);
  return false;
}
コード例 #6
0
ファイル: bin.c プロジェクト: tvtritin/msp430-os
static usize_t ln(String* args) {
    String not_found = newstr("File not found", 16);
    // get src file
    String path = newstr(args->str, args->size);
    if (path.size == 0) {
        putraw("Source? ", 8);
        get(&path);
    }
    File* src = fopen(path);
    if (src == NULL) {
        println(not_found);
        return 1;
    }
    // get destination path & name
    putraw("Target? ", 8);
    String link_name;
    get(&path); // reusing previously consumed `path`
	Dir* parent;
	parsePath(&path, &link_name);
    parent = open_dir(&path, cwd);
    if (parent == NULL) {
    	println(not_found);
    	return 1;
    }

    return new_file(&link_name, src, parent, t_LINK);
}
コード例 #7
0
ファイル: Fail_Manager.c プロジェクト: shurinm/Manager_Fail
int main ()
{
	WINDOW **win;			//Окна
	char content[2][512][128];	//Содержимое окон
	char patch[2][512];		//Директории в которых мы находимся
	unsigned count[2];
	unsigned active;		//Индекс активного окна
	unsigned print;
	unsigned select;
	int key = 0;

	init_manager(&win, content, count, patch, &active, &print, &select);
	refresh_manager(win, content, active, print, select);
		
	while((key = getch()) != 27)
	{
		switch(key)
		{
			case KEY_DOWN:
				if(print + select >= count[active] - 1)
					continue;
				if(select >= LINES - 3)
					print++;
				else
					select++;
			break;
			case KEY_UP:
				if(print <= 0 && select <= 0)
					continue;
				if(select <= 0)
					print--;
				else
					select--;
			break;
			case KEY_LEFT:
				if(active == LEFT)
					continue;
				active = LEFT;
				print = 0;
				select = 0;
				chdir(patch[active]);
			break;
			case KEY_RIGHT:
				if(active == RIGHT)
					continue;
				active = RIGHT;
				print = 0;
				select = 0;
				chdir(patch[active]);
			break;
			case '\n':
				open_dir(content[active][select + print], patch, content[active], &(count[active]), active);
				print = 0;
				select = 0;
			break;
		}
		refresh_manager(win, content, active, print, select);
	}
	destroy_manager();
}
コード例 #8
0
ファイル: main_bounds.c プロジェクト: tinco/system-validation
int main() {
    init_fs();
    int c = nondet_int();
    int d1 = open_dir(c, "test");
    //assert(d1 < 0);
    return 0;
}
コード例 #9
0
int main(){
  int d1;
  int n = nondet_int();
  init_fs();
  __CPROVER_assume(0 <= n && n < MAX_DIRS);
  d1=open_dir(n,"test");
  assert(d1<0); 
}
コード例 #10
0
static void read_cmd(menu_t* menu,int cmd) {
  switch(cmd) {
  case MENU_CMD_LEFT:
    mpriv->p.current = mpriv->p.menu; // Hack : we consider that the first entry is ../
  case MENU_CMD_RIGHT:
  case MENU_CMD_OK: {
    // Directory
    if(mpriv->p.current->d && !mpriv->dir_action) {
        // Default action : open this dirctory ourself
	int l = strlen(mpriv->dir);
	char *slash =  NULL, *p = NULL;
	if(strcmp(mpriv->p.current->p.txt,"../") == 0) {
	  if(l <= 1) break;
	  mpriv->dir[l-1] = '\0';
	  slash = strrchr(mpriv->dir,'/');
#if HAVE_DOS_PATHS
	  if (!slash)
	    slash = strrchr(mpriv->dir,'\\');
#endif
	  if(!slash) break;
	  slash[1] = '\0';
	  p = strdup(mpriv->dir);
	} else {
	  p = malloc(l + strlen(mpriv->p.current->p.txt) + 1);
	  sprintf(p,"%s%s",mpriv->dir,mpriv->p.current->p.txt);
	}
	menu_list_uninit(menu,free_entry);
	if(!open_dir(menu,p)) {
	  mp_msg(MSGT_GLOBAL,MSGL_ERR,MSGTR_LIBMENU_CantOpenDirectory,p);
	  menu->cl = 1;
	}
	free(p);
    } else { // File and directory dealt with action string.
      int fname_len = strlen(mpriv->dir) + strlen(mpriv->p.current->p.txt) + 1;
      char filename[fname_len];
      char *str;
      char *action = mpriv->p.current->d ? mpriv->dir_action:mpriv->file_action;
      sprintf(filename,"%s%s",mpriv->dir,mpriv->p.current->p.txt);
      str = replace_path(action, filename,1);
      mp_input_parse_and_queue_cmds(str);
      if (str != action)
	free(str);
    }
  } break;
  case MENU_CMD_ACTION: {
    int fname_len = strlen(mpriv->dir) + strlen(mpriv->p.current->p.txt) + 1;
    char filename[fname_len];
    char *str;
    sprintf(filename,"%s%s",mpriv->dir,mpriv->p.current->p.txt);
    str = replace_path(action, filename,1);
    mp_input_parse_and_queue_cmds(str);
    if(str != action)
      free(str);
  } break;
  default:
    menu_list_read_cmd(menu,cmd);
  }
}
コード例 #11
0
ファイル: file.cpp プロジェクト: whthend/FIleManager_OS
int show_file_info(char* name) 
{
	int inode;
	Inode temp;
	char original_name_path[30];
	int original_inode = inode_num;//记录当前的inode

	strcpy(original_name_path, name);
	if (eat_path(name) == -1) {
		printf("stat: cannot stat‘%s’: No such file or directory\n", original_name_path);
		return -1;
	}

	inode = check_name(inode_num, name);
	if (inode == -1) {
		printf("stat: cannot stat '%s': No such file or directory\n", original_name_path);
		close_dir(inode_num);
		inode_num = original_inode;
		open_dir(inode_num);
		return -1;
	}
	
	fseek(Disk, InodeBeg + sizeof(Inode)*inode, SEEK_SET);
	fread(&temp, sizeof(Inode), 1, Disk);

	printf("File: '%s'\n", original_name_path);

	printf("Size: %d\tBlocks: %d\t", temp.file_size, temp.blk_num);
	temp.type == Directory ? printf("type: directory\n") : printf("type: regular file\n");

	printf("Inode: %d\t", inode);
	printf("Access: ");
	temp.access[0][user_num] ? printf("r") : printf("-");
	temp.access[1][user_num] ? printf("w") : printf("-");
	temp.access[2][user_num] ? printf("x") : printf("-");
	printf("\n");
	printf("Access: %s", ctime(&temp.i_atime));
	printf("Modify: %s", ctime(&temp.i_mtime));
	printf("Change: %s", ctime(&temp.i_ctime));

	close_dir(inode_num);
	inode_num = original_inode;
	open_dir(inode_num);
	return 0;
}
コード例 #12
0
ファイル: mksfs.c プロジェクト: 151706061/ucore_lab
static void
add_dir(struct sfs_fs *sfs, struct cache_inode *parent, const char *dirname, int curfd, int fd, ino_t real) {
    assert(search_cache_inode(sfs, real) == NULL);
    struct cache_inode *current = alloc_cache_inode(sfs, real, 0, SFS_TYPE_DIR);
    safe_fchdir(fd), subpath_push(sfs, dirname);
    open_dir(sfs, current, parent);
    safe_fchdir(curfd), subpath_pop(sfs);
    add_entry(sfs, parent, current, dirname);
}
コード例 #13
0
ファイル: bin.c プロジェクト: tvtritin/msp430-os
static usize_t ls(String* args) {
	Dir* dir = open_dir(args, cwd);
    if(dir == NULL) {
    	return 1;
	}
	else {
		list_files(dir);
	}
	return 0;
}
コード例 #14
0
ファイル: bin.c プロジェクト: tvtritin/msp430-os
static usize_t cd(String* args) {
	Dir* dir = open_dir(args, &root);
    if(dir == NULL) {
    	return 1;
	}
	else {
		cwd = (Dir*) dir;
	}
	return 0;
}
コード例 #15
0
ファイル: fanotify04.c プロジェクト: sathnaga/ltp
void test01(void)
{
	/* Check ONLYDIR on a directory */
	CHECK_MARK(".", FAN_MARK_ONLYDIR, 0, NULL);

	/* Check ONLYDIR without a directory */
	CHECK_MARK(fname, FAN_MARK_ONLYDIR, -1, NULL);

	/* Check DONT_FOLLOW for a symlink */
	CHECK_MARK(sname, FAN_MARK_DONT_FOLLOW, 0, test_open_symlink);

	/* Check without DONT_FOLLOW for a symlink */
	CHECK_MARK(sname, 0, 0, test_open_file);

	/* Verify FAN_MARK_FLUSH destroys all inode marks */
	if (fanotify_mark(fd_notify, FAN_MARK_ADD,
			    FAN_OPEN, AT_FDCWD, fname) < 0) {
		tst_brk(TBROK | TERRNO,
		    "fanotify_mark (%d, FAN_MARK_ADD, FAN_OPEN, "
		    "AT_FDCWD, '%s') failed", fd_notify, fname);
	}
	if (fanotify_mark(fd_notify, FAN_MARK_ADD,
			    FAN_OPEN | FAN_ONDIR, AT_FDCWD, dir) < 0) {
		tst_brk(TBROK | TERRNO,
		    "fanotify_mark (%d, FAN_MARK_ADD, FAN_OPEN | "
		    "FAN_ONDIR, AT_FDCWD, '%s') failed", fd_notify,
		    dir);
	}
	open_file(fname);
	verify_event(S_IFREG);
	open_dir(dir);
	verify_event(S_IFDIR);
	if (fanotify_mark(fd_notify, FAN_MARK_FLUSH,
			    0, AT_FDCWD, ".") < 0) {
		tst_brk(TBROK | TERRNO,
		    "fanotify_mark (%d, FAN_MARK_FLUSH, 0, "
		    "AT_FDCWD, '.') failed", fd_notify);
	}

	open_dir(dir);
	verify_no_event();
}
コード例 #16
0
	directory_iterator::directory_iterator(const path& p) {


		error_code ec;

		open_dir(p, ec);
		if (ec) throw filesystem_error("directory_iterator::directory_iterator", p, ec);

		increment(ec);
		if (ec) throw filesystem_error("directory_iterator::directory_iterator", p, ec);
	}
コード例 #17
0
ファイル: unpak.c プロジェクト: marcomorain/monkeyslug
// Given the path to a file
// Open the containing folder, and return a pointer
// the start of the file name
// 'foo/bar/baz.bsp' =>
//   chdir('foo/bar'); return 'baz.bsp'
static char* create_dir_and_open(char* path)
{
    char* last_sep = strrchr(path, '/');
    if (!last_sep) return path;

    // Add a null between folder and file 
    // "foo/bar/baz.bsp" => "foo/bar" {0} "baz.bsp"
    *last_sep = 0;
    
    
    open_dir(path);
    
    return last_sep + 1;
}
コード例 #18
0
ファイル: bin.c プロジェクト: tvtritin/msp430-os
static usize_t mkdir(String* args) {
    String path = {args->str, args->size};
    if (path.str[path.size - 1] == '/') {
    	path.size -= 1; // valid but not useful
    }
    String dir_name;
    Dir* parent;
    parsePath(&path, &dir_name);
    parent = open_dir(&path, cwd);
    if (parent == NULL) {
    	return 1;
    }

    return new_file(&dir_name, NULL, parent, t_DIR);
}
コード例 #19
0
ファイル: running.c プロジェクト: cfillion/vifm
/* Runs current file entry of the view in a generic way (entering directories
 * and opening files in editors). */
static void
run_with_defaults(FileView *view)
{
	if(view->dir_entry[view->list_pos].type == FT_DIR)
	{
		open_dir(view);
	}
	else if(view->selected_files <= 1)
	{
		view_current_file(view);
	}
	else if(vim_edit_selection() != 0)
	{
		show_error_msg("Running error", "Can't edit selection");
	}
}
コード例 #20
0
ファイル: mksfs.c プロジェクト: 151706061/ucore_lab
int
create_img(struct sfs_fs *sfs, const char *home) {
    int curfd, homefd;
    if ((curfd = open(".", O_RDONLY)) < 0) {
        bug("get current fd failed.\n");
    }
    if ((homefd = open(home, O_RDONLY | O_NOFOLLOW)) < 0) {
        bug("open home directory '%s' failed.\n", home);
    }
    safe_fchdir(homefd);
    open_dir(sfs, sfs->root, sfs->root);
    safe_fchdir(curfd);
    close(curfd), close(homefd);
    close_sfs(sfs);
    return 0;
}
コード例 #21
0
ファイル: dir.cpp プロジェクト: VictorCPH/fileSystem
/*进入子目录*/
int enter_child_dir(int inode, char* name)
{
	if (type_check(name) != Directory) {
		return -1;
	}

	int child;
	child = check_name(inode, name);

	/*关闭当前目录,进入下一级目录*/
	close_dir(inode);
	inode_num = child;
	open_dir(child);

	return 1;
}
コード例 #22
0
ファイル: recursive.c プロジェクト: vatout/tar-recode
int	write_dir_header(char *name, int tar, t_count *count)
{
  t_header	*header;

  if ((header = create_header(name)) == NULL)
    return (1);
#ifdef DEBUG
  printf("%s is a dir\n", name);
#endif
  open_dir(name, tar, count, header);
#ifdef DEBUG
  printf("OPEN DIR OK\n");
#endif
  free(header);
  free(name);
  return (0);
}
コード例 #23
0
ファイル: dos2unix.c プロジェクト: cookrn/openamq
int main (int argc, char *argv[])
{
    DIRST
        dir;
    char
        *directory,
        *filename,
        *slash;

    if (argc == 1 || streq (argv [1], "/?")) {
        puts ("dos2unix - part of the iMatix RealiBase Gaggle");
        puts ("Strip CR characters from text file.\n");
        puts ("syntax: dos2unix [/?] [filename]");
        puts (" /?       - show help on command");
        puts (" filename - file to expand");
        exit (0);
    }
    filename = argv [1];
    if (strchr (filename, '*') || strchr (filename, '?'))
      {
        directory = mem_strdup (filename);
        slash = strrchr (directory, '\\');
        if (!slash)
            slash = strrchr (directory, '/');
        if (!slash)
            directory = ".";
        else
          {
            *slash = '\0';
            filename = slash + 1;
          }
        if (open_dir (&dir, directory)) do
          {
            if ((dir.file_attrs & ATTR_HIDDEN) == 0
            &&  (dir.file_attrs & ATTR_SUBDIR) == 0)
                if (file_matches (dir.file_name, filename))
                    convert (directory, dir.file_name);
          }
        while (read_dir (&dir));
        close_dir (&dir);
      }
    else
        convert (".", filename);
    exit (0);
}
コード例 #24
0
ファイル: dirtree_view.cpp プロジェクト: descent/qtermwidget
// use combobox select dir need this member function
void DirTreeView::gen_dirs(QListViewItem *item)
{
  qDebug("in gen_dirs");
  if (item==0) 
  {
    qDebug("no point a item");
    return;
  }


  DirTreeViewItem *cur_item=(DirTreeViewItem*)item;
   

  //DirTreeViewItem *cur_item=(DirTreeViewItem*)item;
  qDebug("dirname: %s", cur_item->dirname().c_str());
  qDebug("basename: %s", cur_item->basename().c_str());


  if (open_dir(cur_item->get_fullpath() )==OPENDIR_FAIL) return;

  // erase all child item
  del_child_item(item);
  

  for (size_t i=0 ; i < dirs_.size() ; ++i)
  {
    if (dirs_[i]=="." || dirs_[i]=="..") continue;

    QString qstr;
    if (DS::big5str_to_qstr(dirs_[i], qstr)!=0)
    {
      DirTreeViewItem* node=new DirTreeViewItem(cur_item, "?");
      qDebug("d_name: %s", dirs_[i].c_str());
      node->save_fn(dirs_[i].c_str());
    }
    else
      new DirTreeViewItem(cur_item, qstr);
  }

  cur_item -> set_open(true);

  //setOpen(item, true);

}
コード例 #25
0
ファイル: dirtree_view.cpp プロジェクト: descent/qtermwidget
void DirContent::gen_dir_content(const std::string &dir_fp)
{
  qDebug("in gen_dirs_content(const std::string &dir_fp)");


  if (open_dir(dir_fp.c_str())==OPENDIR_FAIL) 
  { 
    opendir_=false;
    return;
  }
  opendir_=true;

  clear();
  gen_items(files_, false);
  gen_items(dirs_, true);


  set_dirname(dir_fp);
  qDebug("set_dirname: %s", dir_fp.c_str());
}
コード例 #26
0
ファイル: running.c プロジェクト: cfillion/vifm
static void
handle_file(FileView *view, FileHandleExec exec, FileHandleLink follow)
{
	char full_path[PATH_MAX];
	int executable;
	int runnable;
	const dir_entry_t *const curr = &view->dir_entry[view->list_pos];

	get_full_path_of(curr, sizeof(full_path), full_path);

	if(is_dir(full_path) || is_unc_root(view->curr_dir))
	{
		if(!curr->selected && (curr->type != FT_LINK || follow == FHL_NO_FOLLOW))
		{
			open_dir(view);
			return;
		}
	}

	runnable = is_runnable(view, full_path, curr->type, follow == FHL_FOLLOW);
	executable = is_executable(full_path, curr, exec == FHE_NO_RUN, runnable);

	if(stats_file_choose_action_set() && (executable || runnable))
	{
		/* The call below does not return. */
		vifm_choose_files(view, 0, NULL);
	}

	if(executable && !is_dir_entry(full_path, curr->type))
	{
		execute_file(full_path, exec == FHE_ELEVATE_AND_RUN);
	}
	else if(runnable)
	{
		run_selection(view, exec == FHE_NO_RUN);
	}
	else if(curr->type == FT_LINK)
	{
		follow_link(view, follow == FHL_FOLLOW);
	}
}
コード例 #27
0
void    recurse_in_directory(t_item *child_to_parent, t_args *args)
{
    DIR		*fd_file;
    
    fd_file = NULL;
    if (is_directory(child_to_parent) == 1 && is_dot(child_to_parent->name) == 0)
    {
        if ((fd_file = open_dir(child_to_parent->path)))
        {
            closedir(fd_file);
            ft_putchar('\n');
            args->options->Q ? ft_putchar('"') : 0;
            ft_putstr(child_to_parent->path);
            args->options->Q ? ft_putchar('"') : 0;
            ft_putstr(":\n");
            create_children(child_to_parent, args);
        }
        else 
            cannot_open(child_to_parent, args);
    }
}
コード例 #28
0
ファイル: filetypes_menu.c プロジェクト: langner/vifm
/* Callback that is called when menu item is selected.  Should return non-zero
 * to stay in menu mode. */
int
execute_filetype_cb(FileView *view, menu_info *m)
{
	if(view->dir_entry[view->list_pos].type == FT_DIR && m->pos == 0)
	{
		open_dir(view);
	}
	else
	{
		const char *prog_str = strchr(m->data[m->pos], '|') + 1;
		if(prog_str[0] != '\0')
		{
			int background = m->extra_data & 1;
			run_using_prog(view, prog_str, 0, background);
		}
	}

	clean_selected_files(view);
	redraw_view(view);
	return 0;
}
コード例 #29
0
ファイル: dirtree_view.cpp プロジェクト: descent/qtermwidget
int DirContent::gen_dir_content(QListViewItem *item)
{
  qDebug("in gen_dirs_content(QListViewItem *item)");
  if (item==0) 
  {
    opendir_=false;
    qDebug("no point a item");
    return -1;
  }

  FOListViewItem *cur_item=(FOListViewItem*)item;

  std::string opendir_fp=(cur_item->get_fullpath());
  return gen_dir_content(cur_item->get_fullpath());


  int open_dir_status=open_dir(opendir_fp.c_str());
  if (open_dir_status==OPENDIR_FAIL || open_dir_status==ALREADY_OPEN) 
  { 
    qDebug("OPENDIR_FAIL or ALREADY_OPEN");
    opendir_=false;
    return -2;
  }
  opendir_=true;

    dn_=cur_item->get_fullpath();

  // because clear() will delete all item, so after claer(),
  // don't use item object;
  clear();
  gen_items(files_, false);
  gen_items(dirs_, true);


  set_dirname(dn_);
  file_monitor_->monitor_file(dn_.c_str());
  qDebug("set_dirname: %s", dn_.c_str());
  emit cur_dir(dn_);
  return 0;
}
コード例 #30
0
  dir_cpi_impl::dir_cpi_impl (proxy                * p, 
                              cpi_info       const & info,
                              saga::ini::ini const & glob_ini,
                              saga::ini::ini const & adap_ini,
                              boost::shared_ptr<saga::adaptor> adaptor)

      : directory_cpi (p, info, adaptor, cpi::Noflags), 
        dserv_( serv_.get_sector_dir_service())
  {
    std::string error ; 
    adaptor_data_t            adata (this);
    directory_instance_data_t idata (this);

    /* Parse the location and open the directory 
     */
    location =  idata->location_  ; 
    set_dir_name() ; 
    s_ = p->get_session() ; 
    mode = idata->mode_ ; 


    /* 
    if( !adata->get_auth_flag() )
    {
       bool auth = adata->authenticate( s_, location, mode, serv_, glob_ini, adap_ini ) ; 
       if( !auth )
       {
          SAGA_ADAPTOR_THROW ("Could not authenticate with the Sector/Sphere Master Server.", saga::NoSuccess ) ; 
       }
       adata->set_auth_flag() ; 
    }
    */

    bool open = open_dir( error ) ; 
    if( !open )
    {
      SAGA_ADAPTOR_THROW ( error , saga::NoSuccess ) ; 
    }

  }