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

*** Please try to reproduce your bug and confirm the bug fix. ***

Moderators: XnTriq, helmut, xnview, Dreamer

User avatar
CreativeWorld
Posts: 143
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: 45577
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: 143
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: 45577
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.
User avatar
xnview
Author of XnView
Posts: 45577
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 »

This problem is supposed to be fixed in XnView MP 1.8.0. Please check and confirm the bug fix here.
Pierre.
ThalesHUN
Posts: 2
Joined: Fri Sep 06, 2024 2:17 pm

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

Post by ThalesHUN »

XnView MP 1.8.0 here. Windows 10 Ent 22H2
The problem still exist. Can not open images from File explorer / Total Commander / XnView MP Browser
Registry has the path limit unlocked.
The max path char length that XnView MP can handle is 255char with folder separators (backslashes), file extension, and network path double backslash, like \\server\share\folder1name\folder2name\filename.jpg
If the path has 255 chars, the image can be opened. If the path is 256 or more char long, the file can not be opened.
It does not matter if the file or folder(s) name being altered in order to get below the 256 char long.


2024-09-09 114222 XnView MP long path reg unlocked.jpg
You do not have the required permissions to view the files attached to this post.
User avatar
stst415
Posts: 1
Joined: Sun Mar 16, 2025 1:44 am

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

Post by stst415 »

I have the current Version 2.52.0 (Nov 24 2024) version of XnView Classic for Windows. I also have the ability to use directory paths longer than 256 characters already set in the Windows 10 registry.

But, unfortunately, the XnView Classic browser still crashes when it reaches those subfolders.

I absolutely love this software, but this is truly the greatest annoyance that I have with it....

Can somebody from the development team please, please, please prioritize fixing it??

Thank you,
stst415 / Los Angeles, CA
User avatar
xnview
Author of XnView
Posts: 45577
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 »

stst415 wrote: Sun Mar 16, 2025 1:53 am Can somebody from the development team please, please, please prioritize fixing it??
it fixed in XnView MP
Pierre.
ThalesHUN
Posts: 2
Joined: Fri Sep 06, 2024 2:17 pm

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

Post by ThalesHUN »

XnView MP 1.8.6 here.
It seems it can handle long paths, if the (network) path is mapped to a local drive letter in Windows.
So if it is like: Y:\Folder1\FolderB\filename_long.jpg it is ok.
But if this is not mapped to local drive, so it is like: \\SYNOLOGY_NAS\SharedFolder\Folder1\FolderB\filename_long.jpg , XnViw MP failes to open the file.
Of course the path is longer than 260char.. the example is just for the URL style, not the length.
So i have to map the drive now, to be able to access the images through Total Commander and XnView MP.
Windows Explorer does not handle these long paths... interesting.