On 05/12/2011 13:47, franck.eyr...@jrc.ec.europa.eu wrote:
(I could try to contribute, if you think it would require few changes, but I didn't work with c/c++ for a long time)
I anyway had a curious look at the source code; I noticed at line 349 of MirrorJob.cc the following code :

         if(target_is_local && !script_only)
         {
            if(lstat(target_name,&st)!=-1)
            {
               if(S_ISDIR(st.st_mode))
               {
                  chmod(target_name,st.st_mode|0700);
                  create_target_dir=false;
               }
               else
               {
                  Report(_("Removing old local file `%s'"),
                           dir_file(target_relative_dir,file->name));
                  if(remove(target_name)==-1)
                  {
eprintf("mirror: remove(%s): %s\n",target_name,strerror(errno));
                     goto skip;
                  }
                  create_target_dir=true;
               }
            }
         }

The S_ISDIR at line 353 test doesn't take into acount the case where the target file is a link and the links points to a directory, which would suits more my case. In fact, since the whole code above is executed only when !script_only, I realized that running mirror --script=script.lft and then lftp -c script.lftp, it mirrors correctly (but I'm loosing the possibility of parallel downloads). So lftp is able to follow the links, it is just that is decides a priori to delete them. However, I'm not quite sure yet how to handle the "target is link and link points to a directory" test in C++, and don't have time now.

How that helps,

Franck
_______________________________________________
lftp mailing list
lftp@uniyar.ac.ru
http://univ.uniyar.ac.ru/mailman/listinfo/lftp

Reply via email to