Announcement

Collapse
No announcement yet.

Is it possible to show a warning if the length of a filepath exceeds the OS limit?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Is it possible to show a warning if the length of a filepath exceeds the OS limit?

    Hello,

    I was converting and saving some images today and by coincidence I stumbled upon the filepath limit of Windows.
    If your filepath exceeds 260 characters Windows will trim the name, won't allow you to enter more characters or show an error.

    I noticed that IrfanView does nothing like that. It simply crashes.


    If you process files in a batch and one file would exceed the limit when saved, IrfanView simply closes when reaching that file.

    If you try to manually save such a file you get the Windows error that "IrfanView stopped working".


    I know that this is a really rare case but it had me scatching my head for several minutes. Is it possible to add a warning/error message if the total filepath (with file extension) during batch-conversion or manual saving exceeds 260 characters?

    #2
    I could not reproduce the crash in my tests with this path and filename resulting from a batch conversion, however, no files were written.

    What is your OS version and Vivaldi version?
    Before you post ... Edit your profile • IrfanView 4.62 • Windows 10 Home 19045.2486

    Irfan PaintIrfan View HelpIrfanPaint HelpRiot.dllMore SkinsFastStone CaptureUploads

    Comment


      #3
      Windows 7 64 bit, IV version 4.53 64 bit. And isn't Vivaldi an internet browser?

      Further testing shows that it is a very specific case. (The stars have to align. They did for me out of coincidence.)

      I created the following structure to test this:

      Two cascaded folders:
      E:\This_is_a_138_character_long_foldername_iiiiiii iii_iiiiiiiiii_iiiiiiiiii_iiiiiiiiii_iiiiiiiiii_ii iiiiiiii_iiiiiiiiii_iiiiiiiiii_iiiiiiiiii\Now_we_a dd_a_folder_with_56_chars_to_increase_the_length

      E:\This_is_a_138_character_long_foldername_iiiiiii iii_iiiiiiiiii_iiiiiiiiii_iiiiiiiiii_iiiiiiiiii_ii iiiiiiii_iiiiiiiiii_iiiiiiiiii_iiiiiiiiii\Now_we_a dd_a_folder_with_57_chars_to_increase_the_length_


      Put a few files in the "56" folder:

      This_is_some_image_with_a_long_title__total_length _257.jpg
      This_is_some_image_with_a_long_title_i_total_lengt h_258.jpg
      This_is_some_image_with_a_long_title_ii_total_leng th_259.jpg

      * Edit note: In the finished post there are spaces in the folder- and filenames. I don't know why since I didn't put any there. Keep in mind if you should copy & paste.

      Total filelength:
      "56" folder + file 1: 257
      "56" folder + file 2: 258
      "56" folder + file 3: 259



      Now we batch process / single file save them to the "57" folder.


      If you batch-process them and save them as .JPG, IV will stop at file 3, "259", and show an error: "Can't open file for writing."
      When I save the files manually the "259" file will show an error "JPG Save error! Can't open file for writing" and when you click OK IV you get a "IrfanView stopped working" windows error and crashes.

      Total resulting filelength:
      "57" folder + file 1: 258
      "57" folder + file 2: 259
      "57" folder + file 3: "260" - batch stops with error, in single save it throws an error, crashes and then throws a windows error


      __________________________________________________ __________________________________________________ _

      Now comes the specific case that I ran into by accident:
      I didn't save the files as .jpg, I saved them as .webp.

      Batch conversion:
      File 1 converts, during processing of file 2 the program freezes and you get the error "IrfanView stopped working".
      But there are also cases where the program simply closes without Windows giving you an error.

      Single save:
      Upon hitting "save" for file 2 you get the error "IrfanView stopped working".

      Total resulting filelength:
      "57" folder + file 1: 259
      "57" folder + file 2: "260" - crashes and throws windows error in single save, in batch mode sometimes with windows error, sometimes without

      __________________________________________________ __________________________________________________ _


      To sum up my observation:

      If you save an image as .jpg and the the total pathlength of the resulting file reaches 260 characters, the program will throw an error. When saving single images it shows an error, then crashes and shows a windows error.

      If you try to save images as .webp where the total pathlength of the resulting file reaches 260 characters, the program will terminate without throwing a program error. It will only show the windows error. In batch conversion there is a good chance that it will simply terminate without throwing any errors.



      P.S. You can only set your IrfanView version in the profile to a version as recent as 4.51, 4.53 isn't listed.
      Last edited by Pete; 06.08.2020, 03:13 PM.

      Comment

      Working...
      X