Bug 477433 - Incorrect prompt "Can't compare file with folder" from command-line when only specify two folder
Summary: Incorrect prompt "Can't compare file with folder" from command-line when only...
Status: RESOLVED FIXED
Alias: None
Product: kdiff3
Classification: Applications
Component: application (other bugs)
Version First Reported In: unspecified
Platform: Arch Linux Linux
: NOR normal
Target Milestone: ---
Assignee: michael
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-23 19:54 UTC by mr.yming81
Modified: 2023-11-25 13:36 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed/Implemented In:
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description mr.yming81 2023-11-23 19:54:57 UTC
SUMMARY
Error prompted "Can't compare file with folder" when using kdiff3 to compare two folders from command-line. I read the source code, maybe need to check m_sd3 is empty when doing directory compare cause the third folder is optional. 

```
-   if((m_bDirCompare && (!m_sd2->isDir() || !m_sd3->isDir())) ||
+   if((m_bDirCompare && (!m_sd2->isDir() || (!m_sd3->isEmpty() && !m_sd3->isDir()))) ||
       (!m_bDirCompare && (m_sd2->isDir() || m_sd3->isDir())))
    {
        ...
    }
```


STEPS TO REPRODUCE
1. install kdiff3-git from AUR
2. execute "kdiff3 folder1 folder2"
3. 

OBSERVED RESULT
KMessageBox popped with "Can't compare file with folder"

EXPECTED RESULT
No "Can't compare file with folder" prompted

SOFTWARE/OS VERSIONS
Windows: 
macOS: 
Linux/KDE Plasma: 
(available in About System)
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 michael 2023-11-25 13:36:00 UTC
Git commit b0337052834dbba7dcd4aa15d05641b99b1e6b89 by Michael Reeves.
Committed on 25/11/2023 at 02:41.
Pushed by mreeves into branch 'master'.

Fix false error comparing two folders

M  +1    -1    src/kdiff3.cpp

https://invent.kde.org/sdk/kdiff3/-/commit/b0337052834dbba7dcd4aa15d05641b99b1e6b89