darktable-org / darktable

darktable is an open source photography workflow application and raw developer
https://www.darktable.org
GNU General Public License v3.0
9.78k stars 1.14k forks source link

Adding mapped folder to library skips initial letter on folders (Windows 10) #14554

Open macalje opened 1 year ago

macalje commented 1 year ago

Describe the bug

The error/bug: When I'm trying to import images from a folder on my NAS through a mapped device in Windows 10 the initial letter of the folders name is removed so no pictures are imported.

What has been done when this occur: On my NAS I have a map consisting 2 folders with pictures I want to add to my library. When I add them to my library pointing directly at my NAS I get them in the library but can't access them as "folders". Not sure if that's even suppose to work så I tried to do a "work around" by mapping the folder on my NAS directly in file explorer in Windows 10.

In the add to library dialouge window it all seems fine, with folder name\folder name\etc\filename. But when the import of the pictures start I get error-messages for all the images? Now the error-messages past very fast but there where slightly a little bit more than 25000 images så there where some time to notice the beginning of the path. Thats when I noticed that the initial letters of the folders where missing. Guess thats also why I got the error messages. The path was pointing at folders that did not exist.

After this I tried again but this time, I pointed at one of the 2 parent folders directly. Now it worked!?

Steps to reproduce

  1. Use a NAS from Synology.
  2. Open the default photo folder.
  3. Create 2 folders, each one containing subfolders in 3 to 4 levels.
  4. One of the two parent folders containing only RAW-files from Minolta, Pentax, Canon, Lumix and Sony.
  5. The other parent folder contains only JPG, JPEG and HEIC.
  6. There are already existing xmp-files for all files in both parent folders.
  7. In Windows 10 file explorer, map the default folder photo and give it a free letter (in my case it was Z)
  8. Open darktable
  9. Under import, click add to library.
  10. Go to the mapped folder photo (Z:).
  11. Uncheck select only new pictures, check recursive directory, uncheck ignore JPEG images.
  12. Select all images. The list will contain all images from both parent folders.
  13. Hit add to library.

Expected behavior

Import all the images that was selected

Logfile | Screenshot | Screencast

No response

Commit

No response

Where did you install darktable from?

darktable.org

darktable version

4.2.1

What OS are you using?

Windows

What is the version of your OS?

Windows 10, 21H2, 19044.2965

Describe your system?

CPU: AMD Ryzen 5 5600X 6-Core Processor 3.70 GHz RAM: 16,0 GB

Are you using OpenCL GPU in darktable?

I dont know

If yes, what is the GPU card and driver?

Nvidia GeForce GT 1060, 3GB

Please provide additional context if applicable. You can attach files too, but might need to rename to .txt or .zip

No response

macalje commented 1 year ago

To solve this I've mapped the folder on the NAS containing subfolders with images. Then it works. It still doesn't work if I try to go directly to the NAS.

github-actions[bot] commented 1 year ago

This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.

ralfbrown commented 5 months ago

Took a look. I don't use Windows, but there's something suspicious about the #ifdef WIN32 in file src/libs/import.c, specifically the occurrence in function _import_add_file_callback. I suspect that all three occurrences of WIN32 in that file should actually be _WIN32.

@wpferguson ?

wpferguson commented 5 months ago

I don't know. I just build for windows, and maybe test once in awhile. I'm not masochistic enough to develop on it.

However I did:

src$ rgrep WIN32 | grep -v _WIN32 | grep -v CMake | grep -v external
win/win.h:// #define WIN32_LEAN_AND_MEAN
win/filepath.c:    WIN32_FIND_DATAW data;
control/conf.c:#ifdef WIN32
common/darktable.c:#if defined(WIN32)
common/utility.c:#if defined(WIN32)
common/utility.c:#if defined(WIN32)
common/utility.c:#ifdef WIN32
common/dlopencl.c:#if defined(WIN32)
common/utility.h:#ifdef WIN32
common/import_session.c:#ifdef WIN32
common/import_session.c:#ifdef WIN32
chart/colorchart.c:// In some environments ERROR is already defined, ie: WIN32
libs/import.c:#ifdef WIN32
libs/import.c:#ifdef WIN32
libs/import.c:#ifdef WIN32

It does seem that _WIN32 is the correct definition, so I wonder how many problems will get fixed by changing those, and how many new problems will crop up by changing those?

@kmilos thoughts?

kmilos commented 5 months ago

MinGW defines both WIN32 and _WIN32.

ralfbrown commented 5 months ago

Is that also true for MSYS2? if not (or we just want consistency), I can make a PR that changes all the WIN32 to _WIN32, since there's only a dozen.

kmilos commented 5 months ago

Is that also true for MSYS2?

It is. I guess you could make a change if you prefer a consistent style.

github-actions[bot] commented 3 months ago

This issue has been marked as stale due to inactivity for the last 60 days. It will be automatically closed in 300 days if no update occurs. Please check if the master branch has fixed it and report again or close the issue.