todds-encoder / todds

A CPU-based DDS encoder optimized for fast batch conversions with high encoding quality.
Mozilla Public License 2.0
18 stars 4 forks source link

Encoding skips following symlinks #46

Open dormieriancitizen opened 1 month ago

dormieriancitizen commented 1 month ago

Describe the bug Encoding a folder seems to skip symlinks when searching for files to encode. That's fine if intended, but it would be nice to have a flag to toggle following/not following symlinks.

To Reproduce Steps to reproduce the behavior:

  1. Make folder with symlink to other folder that contains a png file
  2. encode
  3. nothing gets encoded

Expected behavior

  1. png in other folder gets encoded

System (please complete the following information):

joseasoler commented 1 month ago

Thank you for the report, @dormieriancitizen . I cannot reproduce this issue on Arch Linux after creating a symlink using ln -s, pointing to a folder with a single png file, and then pointing ToDDS to the symlink folder:

/home/joseasoler/dev/todds/cmake-build-debug/src/main/todds -v /home/joseasoler/delete/symlink
Retrieving files to be processed.
File retrieval time: 0.000 seconds.
/home/joseasoler/delete/test/some_texture.png
Processing 1 textures.
dormieriancitizen commented 1 month ago

This isn't exactly what I mean; rather, creating a folder with a png, creating a symlink to that folder, placing that symlink in a parent folder, then pointing ToDDS at the parent folder; ie

mkdir regular_directory #place the PNG here
mkdir example_parent_directory
ln -s ../regular_directory example_parent_directory/symlink
todds -v example_parent_directory

This does not encode the PNG file placed in the regular directory. If I recreate symlink with an absolute instead of relative path, the PNG file in the regular directory is still not encoded.

joseasoler commented 1 month ago

One thing to mention is that ToDDS has a bug which will prevent it from finding any files unless -ss or -r are used to explicitly choose a filter. Does using one of these parameters help with the situation? EDIT: This bug is now fixed in latest.

Since the ln -s command in your example uses ../regular_directory, I am assuming that example_parent_directory has a parent folder, which is in the same folder as regular_directory, so something like this:

rm -rf regular_directory
mkdir parent_directory
cd parent_directory
mkdir png_directory
cp ../image.png png_directory
mkdir second_parent_directory
cd second_parent_directory
mkdir third_parent_directory
ln -s ../png_directory third_parent_directory/symlink
~/dev/todds/cmake-build-debug/src/main/todds -v -ss png third_parent_directory/symlink
Retrieving files to be processed.
File retrieval time: 0.000 seconds.
/home/joseasoler/delete/parent_directory/png_directory/image.png
Processing 1 textures.