MobileSheets Forums

Full Version: Swap File dialog only displays the first characters of a filename
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi forum,

when using the "Swap File" function to replace a song by an updated version the dialog that finally asks whether file A should be replaced by file B (A and B being filenames) does truncate the filenames when the length exceeds a certain limit.

I occasionally happen to have rather long filenames, the longest currently are
  • Jaakko-Mäntyjärvi-1984-Four-Shakespeare-Songs-1-Come-Away-Death.pdf
  • Jaakko-Mäntyjärvi-1984-Four-Shakespeare-Songs-2-Lullaby.pdf
  • Jaakko-Mäntyjärvi-1984-Four-Shakespeare-Songs-3-Double-Double-Toil-and-Trouble.pdf
  • Jaakko-Mäntyjärvi-1984-Four-Shakespeare-Songs-4-Full-Fathom-Five.pdf
Their names are truncated somewhere in ...-Shakespeare which isn't very helpful.

Could the corresponding dialog linebreak the names and display them in full?

I'm on Windows 10 Pro, MS Version 1.9.2

Kind regards,
Hi Michael,

In the Windows API, there are a number of functions that have a maximum path limit of 255 for some reason. Due to this, I'm forced to truncate the paths in MobileSheets so that they are 255 characters or less. What you are seeing on that dialog is the result of that truncation. There doesn't seem to be anything I can do about it, as it's a limitation in Microsoft's framework. So I can display the full file name, but that's not going to match the actual file name that is used on disk. Would you still prefer this? If so, I can look into showing the full file name regardless of what will actually be used by MobileSheets.

Hi Mike, this limitation still there?
That dates back to the days when all we had was FAT and FAT32.
Haven't programmed for the win32 API in ages...thought that was gone long ago...but thinking about it it makes sense since there are useability issues in Windows Explorer with files in deep directory structures (where paths get very long).

Coming back to your sugestion to work around this:
In my current very special usecase I came across this it would help but I don't think it would be a good idea to implement such a hack as it most certainly would screw many other cases. There is no virtue in knowingly imlementing bad design to circumvent shortcomings elsewhere unless absolutely required.

I can work around this problem by being careful when chosing files in the first place. Now knowing the technical reason for this I will try to shorten the paths where I store my pdfs.

Kind regards,
Delphi/Lazarus (pascal based) have a MinimiseName function which adjusts a file name so that it fits into a specified width (I'm sure you are not using pascal but it might give you some ideas). This thread also indicates a way of doing it with an WIN API call (though probably not much use if you want the same code for Android).

Here is the code for the Lazarus MinimiseName function; if you can convert this then the code could possibly be used on both Windows and Android.