This is a proof of concept.
```
$ echo a > hardlinks/a
$ cp hardlinks/{a,b}
$ ln hardlinks/{a,c}
$ cargo run --bin czkawka_cli dup -m 1 --directories $(pwd)/hardlinks -f /dev/stderr > /dev/null
-------------------------------------------------Files with same hashes-------------------------------------------------
Found 1 duplicated files which in 1 groups which takes 2 B.
---- Size 2 B (2) - 2 files
/home/thomas/Development/czkawka/hardlinks/a
/home/thomas/Development/czkawka/hardlinks/b
```
Open:
- Windows support
- Probably this should be a cli option
* Initial Windows taskbar progress support
* Changes to COM (un)init
It turns out winapi exposes IIDs through a `uuidof()` function of interfaces, so the copied one can be removed.
* Don't return error codes
Now the `TaskbarProgress` functions fail silently.
The `TaskbarProgress` struct now will always be created (even in case of errors in initialisation), but it won't do anything.
* Fix builds for other systems
* Formatted code
* Fix progress shown after the operation finished
A progress update was received after the stop event.
Also `as_ref()` was removed in many places (I don't even know why it was there).
* Remove redundant call to hide
It's already called by the `glib_stop_receiver` receiver.
* Release the ITaskbarList3 and call CoUninitialize at exit
Because objects moved to closures used as fallbacks in GTK have [static lifetimes](https://gtk-rs.org/docs-src/tutorial/closures#closures), the `TaskbarProgress` will never be dropped.
To workaround this problem a `release` function is called when the main window is closed. This function behaves like `drop`, but sets the struct in a valid "empty" state, so that calling `release`/`drop` again won't cause problems.
* Don't set the NORMAL state manually
Because only NOPROGRESS and INDETERMINATE states are used, there is no need to set the NORMAL state when changing the progress value.
Now `set_progress_value` will also change the `TaskbarProgress::current_state` if such situation occurs.
> Unless [SetProgressState](https://docs.microsoft.com/en-us/windows/desktop/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressstate)
> has set a blocking state (TBPF_ERROR or TBPF_PAUSED) for the window, a call to **SetProgressValue** assumes the TBPF_NORMAL
> state even if it is not explicitly set. A call to **SetProgressValue** overrides and clears the TBPF_INDETERMINATE state.
See the [SetProgressValue documentation](https://docs.microsoft.com/en-us/windows/win32/api/shobjidl_core/nf-shobjidl_core-itaskbarlist3-setprogressvalue#how-the-taskbar-button-chooses-the-progress-indicator-for-a-group)
The admin-gtk3-dark-osx theme contains relative symlinks, which after copying only this theme are no longer valid.
The -L (--dereference) option makes cp always follow symbolic links, so that all of them are replaced with files they pointed to.
If the user could not create a hard link (due to permissions or
different block devices) then czkawka lost the duplicate file.
```
$ mkdir hardlink
$ cd hardlink
$ echo a > a
$ cp a b
$ chown thetestuser:thetestuser a
$ ls -il .
25169246 -rw-rw-r-- 1 thetestuser thetestuser 2 Feb 7 11:18 a
25169641 -rw-rw-r-- 1 thomas thomas 2 Feb 7 11:18 b
$ cargo run --bin czkawka_cli dup --directories $(pwd) -m 1 -f
test101.result --delete-method HARD
[...]
-------------------------------WARNINGS--------------------------------
Failed to link /home/thomas/Development/czkawka/hardlink/b ->
/home/thomas/Development/czkawka/hardlink/a
---------------------------END OF WARNINGS-----------------------------
$ ls -il .
25169246 -rw-rw-r-- 1 thetestuser thetestuser 2 Feb 7 11:18 a
```
Now czkawka keeps all files and the warning provides more information
why czkawka can't replace the duplicate with a hard link.
```
$ cargo run --bin czkawka_cli dup --directories $(pwd) -m 1 -f
test101.result --delete-method HARD
-------------------------------WARNINGS--------------------------------
Failed to link /home/thomas/Development/czkawka/hardlink/b ->
/home/thomas/Development/czkawka/hardlink/a (Operation not permitted (os
error 1))
---------------------------END OF WARNINGS-----------------------------
[...]
25169246 -rw-rw-r-- 1 thetestuser thetestuser 2 Feb 7 11:18 a
25169641 -rw-rw-r-- 1 thomas thomas 2 Feb 7 11:18 b
```
This results in the same space saving but keeps the "deleted" files around.
$ mkdir hardlink
$ cd hardlink
$ echo a > a
$ cp a b
$ ln a c
$ touch -t 01010000 a
$ ls -il --time-style=full-iso .
25169323 -rw-rw-r-- 2 thomas thomas 2 2021-01-01 00:00:00.000000000 +0100 a
25169558 -rw-rw-r-- 1 thomas thomas 2 2021-01-31 18:11:08.298161098 +0100 b
25169323 -rw-rw-r-- 2 thomas thomas 2 2021-01-01 00:00:00.000000000 +0100 c
$ czkawka_cli dup --directories $(pwd)/hardlink -m 1 -f hardlink.result --delete-method HARD
$ ls --time-style=full-iso -li hardlink
25169323 -rw-rw-r-- 3 thomas thomas 2 2021-01-01 00:00:00.000000000 +0100 a
25169323 -rw-rw-r-- 3 thomas thomas 2 2021-01-01 00:00:00.000000000 +0100 b
25169323 -rw-rw-r-- 3 thomas thomas 2 2021-01-01 00:00:00.000000000 +0100 c
* Make a flatpak manifest, the permissions are not set properly.
* Move to separate flatpak dir
* Rewrite in yaml
* Update sources
* Update flatpak to 2.3.0
* Remove PulseAudio support
* Add metainfo file
* Use the right files
* Update metadata file
* Polish manifest and improve metadata
* Improve metadata
* Switch to metainfo
* Fix version number
Co-authored-by: Lionir <git@thelion.website>
* Spicing up the README
- Making it more readable
- Better English, easier to read
- Hiding links
- Fixing the absolute hideous tables which were impossible to read in the raw readme
* Fixed some things, not a lot though.