From df9dcc571107d069e01a2cc003d4e32996edc288 Mon Sep 17 00:00:00 2001 From: janwas Date: Wed, 11 Aug 2004 23:25:37 +0000 Subject: [PATCH] opening files as a directory -> problem with dir_watch. solved This was SVN commit r977. --- source/lib/res/vfs.cpp | 34 ++++++---------------------------- 1 file changed, 6 insertions(+), 28 deletions(-) diff --git a/source/lib/res/vfs.cpp b/source/lib/res/vfs.cpp index 16b0a9b5a2..227ce35a4c 100755 --- a/source/lib/res/vfs.cpp +++ b/source/lib/res/vfs.cpp @@ -587,7 +587,7 @@ static int add_dirent_cb(const char* const n_name, const ssize_t size, const uin uint lf_flags = 0; // it's a dir - if(size <= 0) + if(size < 0) { ploc = 0; // need to treat last component as a dir lf_flags |= LF_CREATE_MISSING_DIRS; @@ -599,7 +599,8 @@ static int add_dirent_cb(const char* const n_name, const ssize_t size, const uin if(cur_loc->archive > 0) { lf_flags |= LF_HAVE_LOC; - lf_flags |= LF_CREATE_MISSING_DIRS; + if(size >= 0) + lf_flags |= LF_CREATE_MISSING_DIRS; // grrrr, winzip outputs some dir names after entries in that dir // that means the dir hasn't yet been created } @@ -622,32 +623,6 @@ static int add_dirent_cb(const char* const n_name, const ssize_t size, const uin if(err < 0) debug_warn("add_dirent_cb: tree_lookup failed"); -/* - // file or directory in archive - if(cur_loc->archive > 0) - { - - } - // directory (not in archive) - else if(size < 0) - { - // leave out CVS dirs in debug builds. this makes possible - // user code that relies on a fixed data directory structure. -#ifndef NDEBUG - if(!strcmp_lower(path, "cvs")) - return 0; -#endif - err = cur_dir->add_subdir(path); - } - // file (not in archive) - else - err = cur_dir->add_file(path, cur_loc); - - if(err < 0) - return -EEXIST; -*/ - - return 0; } @@ -670,6 +645,9 @@ static int tree_add_dirR(Dir* const dir, const char* const p_path, const Loc* co Dir* const subdir = &it->second; const char* const d_subdir_name = (it->first).c_str(); +if(strchr(d_subdir_name, '.')) +debug_warn("file stored as dir"); + char p_subdir_path[PATH_MAX]; CHECK_ERR(path_append(p_subdir_path, p_path, d_subdir_name));