1.7.1: XnView on Windows fails to open files when total path length is longer than 512 characters

Bugs which are supposed to be fixed in the next test version (not available yet)

Moderators: XnTriq, helmut, xnview, Dreamer

User avatar
CreativeWorld
Posts: 141
Joined: Fri Dec 30, 2011 7:08 pm

1.7.1: XnView on Windows fails to open files when total path length is longer than 512 characters

Post by CreativeWorld »

XnView MP 1.7.1 - 64-bit
Windows 10 - 64-bit

Greetings! I have many images nested inside folders with long descriptive folder names. When the total path length (folder length + filename length) is over 512 characters, XNview cannot open the images when double clicked in Windows Explorer.

Here are Windows console commands to reproduce the bug. This will create nested folders with two image files inside. One of the files has a total path length of 500 chars and the other's length is 512 chars.

Run all three commands in the console, and then try to open each image in Windows Explorer. Only one image successfully opens! The longer one crashes when double clicked. Is there a 512 char limit on the String variable for the filepath? Can it be increased, for example to 1024 chars?



mkdir "C:\Pictures\This_folder_name_is_220_characters_long_____________________________________________________________________________________________________________________________________________________________________________________\This_folder_name_is_220_characters_long_____________________________________________________________________________________________________________________________________________________________________________________"



copy "C:\Program Files\XnViewMP\FileIcons\bmp.ico" "C:\Pictures\This_folder_name_is_220_characters_long_____________________________________________________________________________________________________________________________________________________________________________________\This_folder_name_is_220_characters_long_____________________________________________________________________________________________________________________________________________________________________________________\This_file_path_is_500_chars_long__________.ico"



copy "C:\Program Files\XnViewMP\FileIcons\bmp.ico" "C:\Pictures\This_folder_name_is_220_characters_long_____________________________________________________________________________________________________________________________________________________________________________________\This_folder_name_is_220_characters_long_____________________________________________________________________________________________________________________________________________________________________________________\This_file_path_is_512_chars_long______________________.ico"
User avatar
xnview
Author of XnView
Posts: 43995
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: 1.7.1: XnView on Windows fails to open files when total path length is longer than 512 characters

Post by xnview »

Windows console doesn't allow me to create such path
Pierre.
User avatar
CreativeWorld
Posts: 141
Joined: Fri Dec 30, 2011 7:08 pm

Re: 1.7.1: XnView on Windows fails to open files when total path length is longer than 512 characters

Post by CreativeWorld »

Sorry! Windows must have the "Win32 Long Paths" setting enabled for the console to create those long paths.

Here is how to enable the setting: https://www.tenforums.com/tutorials/517 ... -10-a.html

To make things easier, I attached an archive file I created with 7-Zip. This program supports long file paths, and the standard Windows ZIP archives do not, so I had to use 7-Zip.

Steps to reproduce:
1) Extract the folder from the attached archive using 7-Zip -- or create the paths manually using the console commands.
2) Browse the extracted folder with Windows Explorer until you find the image file nested within.
3) Double click on the image file in Windows Explorer. It fails to open and the XnView BROWSER view opens instead.
4) Copy the image file to different location with a shorter path length and double click -- it now opens successfully!

PS: I use a file browser called XYplorer to create and edit long file paths, because the standard Windows Explorer cannot edit them.

PPS: XnView handles long Unicode file paths well as long as they are shorter than ~512 characters or so. Maybe the variable in the code that stores the filepath has a limit of ~512 chars?
You do not have the required permissions to view the files attached to this post.
User avatar
xnview
Author of XnView
Posts: 43995
Joined: Mon Oct 13, 2003 7:31 am
Location: France

Re: 1.7.1: XnView on Windows fails to open files when total path length is longer than 512 characters

Post by xnview »

:bugconfirmed: Thanks to your detailed description I can reproduce the problem.
Pierre.