Regarding the length of the file name problem

Bugs found in XnView Classic. Please report only one bug per topic!

Moderators: XnTriq, helmut, xnview

Post Reply
foxtail
Posts: 1
Joined: Fri Jun 10, 2016 10:20 am

Regarding the length of the file name problem

Post by foxtail »

When the file name is long it will be reported that the error can not be opened.Please solve this problem.
THANKS! :D
cday
XnThusiast
Posts: 3985
Joined: Sun Apr 29, 2012 9:45 am
Location: Cheltenham, U.K.

Re: Regarding the length of the file name problem

Post by cday »

foxtail wrote:When the file name is long it will be reported that the error can not be opened. Please solve this problem. THANKS! :D
There is a Windows file name length limit I believe, but I don't know the value without checking.

How long, can you post the file name or even the file?

If you are using XnView Classic, file names with unusual characters can't be opened as Unicode isn't supported, try XnView MP...
Mixer
Banned
Posts: 166
Joined: Fri Aug 28, 2015 6:24 am

Re: Regarding the length of the file name problem

Post by Mixer »

Are you trying to open it from local disk or from network share?
Mixer
Banned
Posts: 166
Joined: Fri Aug 28, 2015 6:24 am

Re: Regarding the length of the file name problem

Post by Mixer »

This is not quite correct that XnView can't open file with ANSI name reaching maximum length of 259 "whichever number Explorer allows" pure characters, which is defined in Windows constant MAX_PATH equal to 260 (last 260th = string terminating null-character). It can if you open such file from inside XnView. But when you doubleclick image in Explorer, filename is transferred to XnView as command line and last meaningful character (or more) is lost. Other programs which do not support Unicode too have no problem with opening file with max number of chars long name, so problem is on XnView's side.
+++
Started API Monitor to try to see what happens. Not sure if I picked proper functions to watch, but it seems in general XnView receives all filename string. Then something inside slices this string into parts, and for each part of filename XnView calls GetFileAttributesA function of winapi, which of course fail. Then for first part XnView calls FindFirstFileA, which fails too and finally for this reason is displayed error message with truncated filename.
+++
BUT! This behavior is spotted only in Win 2k and Win XP (I don't have other 32bit Windows to check). In Win 10 x64 XnView successfully opens files of max name length.
Post Reply