Compare Directory - new mode "Content only" that should ignore times



In the Compare directory dialog there are 3 options:

1. quick
2. size only
3. thorough

The problem is when the directories on both panels have random times
(e.g restored/copied from backups in random order) the thorough will
select files randomly because it is only marking newer file which will
be in a random panel, thus making it hard to use. I propose adding new
option:

4. content only

Which would ignore file times and mark modification on current panel
even if other panel have newer file. In src/filemanager/cmd.c in the
compare_dir function on line 300 it would require 1 new lines (marked
// NEW CODE):

            /* Found */
            file_entry_t *target = &other->dir.list[j];

            if (mode != compare_content_only)   // NEW CODE, skip the time check
            if (mode != compare_size_only)
                /* Older version is not marked */
                if (source->st.st_mtime < target->st.st_mtime)
                    continue;

            /* Newer version with different size is marked */
            if (source->st.st_size != target->st.st_size)
            {
                do_file_mark (panel, i, 1);
                continue;
            }

            if (mode == compare_size_only)
                continue;

            if (mode == compare_quick)
            {
                /* Thorough compare off, compare only time stamps */
                /* Mark newer version, don't mark version with the same date */
                if (source->st.st_mtime > target->st.st_mtime)
                    do_file_mark (panel, i, 1);

                continue;
            }

            /* Thorough compare on, do byte-by-byte comparison */
            {
                vfs_path_t *src_name, *dst_name;

                src_name =
                    vfs_path_append_new (panel->cwd_vpath,
source->fname->str, (char *) NULL);
                dst_name =
                    vfs_path_append_new (other->cwd_vpath,
target->fname->str, (char *) NULL);
                if (compare_files (src_name, dst_name, source->st.st_size))
                    do_file_mark (panel, i, 1);
                vfs_path_free (src_name, TRUE);
                vfs_path_free (dst_name, TRUE);
            }

Basically if the compare mode is "Content only" it will skip the date
time checks and use thorough compare and if files differs by content,
mark it as changed in current panel regardless of the time.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]