Fossil

Check-in [f1329470]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Change a few instances of file_isdir() to file_wd_isdir().
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: f1329470c033c748901044390071f056f11e1d03
User & Date: dmitry 2011-09-27 19:15:13
Context
2011-09-27
19:28
Call file_wd_isdir() in file_mkdir(). check-in: 13120e96 user: dmitry tags: trunk
19:15
Change a few instances of file_isdir() to file_wd_isdir(). check-in: f1329470 user: dmitry tags: trunk
16:34
Add the --stats option to the rebuild command. check-in: f25e5e53 user: drh tags: trunk
Changes
Hide Diffs Side-by-Side Diffs Ignore Whitespace Patch

Changes to src/add.c.

   226    226     for(i=2; i<g.argc; i++){
   227    227       char *zName;
   228    228       int isDir;
   229    229       Blob fullName;
   230    230   
   231    231       file_canonical_name(g.argv[i], &fullName);
   232    232       zName = blob_str(&fullName);
   233         -    isDir = file_isdir(zName);
          233  +    isDir = file_wd_isdir(zName);
   234    234       if( isDir==1 ){
   235    235         vfile_scan(&fullName, nRoot-1, includeDotFiles, pIgnore);
   236    236       }else if( isDir==0 ){
   237    237         fossil_fatal("not found: %s", zName);
   238    238       }else if( file_access(zName, R_OK) ){
   239    239         fossil_fatal("cannot open %s", zName);
   240    240       }else{
................................................................................
   504    504     file_tree_name(zDest, &dest, 1);
   505    505     db_multi_exec(
   506    506       "UPDATE vfile SET origname=pathname WHERE origname IS NULL;"
   507    507     );
   508    508     db_multi_exec(
   509    509       "CREATE TEMP TABLE mv(f TEXT UNIQUE ON CONFLICT IGNORE, t TEXT);"
   510    510     );
   511         -  if( file_isdir(zDest)!=1 ){
          511  +  if( file_wd_isdir(zDest)!=1 ){
   512    512       Blob orig;
   513    513       if( g.argc!=4 ){
   514    514         usage("OLDNAME NEWNAME");
   515    515       }
   516    516       file_tree_name(g.argv[2], &orig, 1);
   517    517       db_multi_exec(
   518    518         "INSERT INTO mv VALUES(%B,%B)", &orig, &dest

Changes to src/update.c.

   300    300       const char *zSep;      /* Term separator */
   301    301   
   302    302       blob_zero(&sql);
   303    303       blob_append(&sql, "DELETE FROM fv WHERE ", -1);
   304    304       zSep = "";
   305    305       for(i=3; i<g.argc; i++){
   306    306         file_tree_name(g.argv[i], &treename, 1);
   307         -      if( file_isdir(g.argv[i])==1 ){
          307  +      if( file_wd_isdir(g.argv[i])==1 ){
   308    308           if( blob_size(&treename) != 1 || blob_str(&treename)[0] != '.' ){
   309    309             blob_appendf(&sql, "%sfn NOT GLOB '%b/*' ", zSep, &treename);
   310    310           }else{
   311    311             blob_reset(&sql);
   312    312             break;
   313    313           }
   314    314         }else{
................................................................................
   511    511         Blob path;
   512    512         const char *zPath;
   513    513   
   514    514         blob_zero(&path);
   515    515         blob_appendf(&path, "%s/%s", g.zLocalRoot, zDir);
   516    516         zPath = blob_str(&path);      
   517    517         /* Handle various cases of existence of the directory */
   518         -      switch( file_isdir(zPath) ){
          518  +      switch( file_wd_isdir(zPath) ){
   519    519           case 0: { /* doesn't exist */
   520    520             if( file_mkdir(zPath, 0)!=0 ) {
   521    521               fossil_warning("couldn't create directory %s as "
   522    522                              "required by empty-dirs setting", zDir);
   523    523             }          
   524    524             break;
   525    525           }

Changes to src/vfile.c.

   270    270         }
   271    271         if( cReply=='n' || cReply=='N' ){
   272    272           blob_reset(&content);
   273    273           continue;
   274    274         }
   275    275       }
   276    276       if( verbose ) fossil_print("%s\n", &zName[nRepos]);
   277         -    if( file_isdir(zName) == 1 ){
          277  +    if( file_wd_isdir(zName) == 1 ){
   278    278         /*TODO(dchest): remove directories? */
   279    279         fossil_fatal("%s is directory, cannot overwrite\n", zName);
   280    280       }    
   281    281       if( file_wd_size(zName)>=0 && (isLink || file_wd_islink(zName)) ){
   282    282         file_delete(zName);
   283    283       }
   284    284       if( isLink ){
................................................................................
   387    387         }
   388    388         zUtf8 = fossil_mbcs_to_utf8(pEntry->d_name);
   389    389         blob_appendf(pPath, "/%s", zUtf8);
   390    390         fossil_mbcs_free(zUtf8);
   391    391         zPath = blob_str(pPath);
   392    392         if( glob_match(pIgnore, &zPath[nPrefix+1]) ){
   393    393           /* do nothing */
   394         -      }else if( file_isdir(zPath)==1 ){
          394  +      }else if( file_wd_isdir(zPath)==1 ){
   395    395           if( !vfile_top_of_checkout(zPath) ){
   396    396             vfile_scan(pPath, nPrefix, allFlag, pIgnore);
   397    397           }
   398    398         }else if( file_wd_isfile_or_link(zPath) ){
   399    399           db_bind_text(&ins, ":file", &zPath[nPrefix+1]);
   400    400           db_step(&ins);
   401    401           db_reset(&ins);