Hyphens and periods in Windows file or folder names cause print module problems

Started by rick42, July 21, 2022, 02:27:02 AM

Previous topic - Next topic

rick42

Under some circumstances,
1. the design print module truncates some print/save image file names, particularly after a . or - in a file name. The file name is truncated after the . or -

If there is more than one such punctuation mark, repeated saving of the image file truncates the name back to the preceding mark, shortening the file name further each time.

2. the design print module can also end up saving the printed image files in the target directory's parent directory instead of in the selected directory.

It seems that once the module is unhappy with . in a file name, it subsequently becomes unhappy with . or - if either exists in the directory name as well...

3. when this happened for me, subsequently the print module also started generating arbitrary names for the image files I was trying to save
(they ended up named z-1.jpg, z-2.jpg, etc.), and I eventually found them to actually be saved in the parent of the target directory.

Ironically, it used the - hyphen punctuation mark in the arbitrary file names it generated...  ::)


These problems appear to be triggered by the use of some punctuation marks which Microsoft allows in Windows file names, in the intended file or folder names of print/saved images.


I have found that these problems disappear if the following approach is maintained:

Do not use any punctuation (particularly . - )
A) in the file names of images to be saved by the print module
B) in the names of the directories where these files are to be stored

To be clear, I have never experienced a problem in the Media and Folders or any other tab or app of IMatch, even though I have many folders with - or _ in their file names, but they do not work well with the design print module.


I understand that other applications can also give unexpected results if punctuation marks are included as a part of file or folder names, so best to be safe :) 

I didnt know... ;D   Thanks Mario!

Mario

Don't use more than one . in a file name.

Even if Microsoft allows it, many tools, 3rd party libraries IMatch uses, cross-platform code IMatch uses etc. may not correctly deal with file names with multiple extensions like "this.my.file.name.ext".
I have no control over these 3rd party components.
While "this.my.file.name.ext" is theoretically correct, I would consider this an pretty unsafe file name.

You used file names with more than one . in Design & Print where? In file containers? As output file names for "print to image"? "Print to PDF"?
This is not clear from your description. Where did you use these multi-. file names, exactly?

QuoteIf there is more than one such punctuation mark, repeated saving of the image file tr

You save an image multiple times in IMatch where?
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

rick42

Quote from: Mario on July 21, 2022, 10:13:02 AM
You used file names with more than one . in Design & Print where?

I used file names with more than one . in Design & Print as output file names for "print to image"
- example: Card{File.Name|trim:alpha}landscape5.5x8.5
- it saved as:  Card0188landscape5.5x8.tif

Quote from: Mario on July 21, 2022, 10:13:02 AM
You save an image multiple times in IMatch where?

I repeated the print to image step, keeping the target directory   
(D:\-   -   -     PWGallery files\z.TESTcards from IMatch design template) 
but varying the type of image file (png,TIFF,JPG), and then again trying with different images.

The reason I repeatedly printed to save the same image was that sometimes after saving, there was no result in the target directory, and I would try again. It turned out that these saves were in fact executed, but into the target's parent directory, and with the system generated file names (z-1.png, z-2.png etc.)
The target directory's name started with "z.", which may be related to the z in the automatically generated file names?

Today, to see if I could replicate the problem:
- I set print to image to save in a directory with a . in the name
- tried using print to image as TIFF - nothing saved, anywhere that I could find...
- then I loaded a different image, printed to save it as jpg - and the file saved as z-10.jpg, in the parent directory of the target again

The arbitrary file names and the saving in the parent of the target directory happened when the target directory has a . in its name, but not otherwise

...and yes, so far avoiding using . in file and directory names when working with the design & print module does seem to avoid these problems :)
Thanks!

(log file attached)

Mario

I have fixed this problem for the next release.
It was caused by the way IMatch produces the output file name dynamically when generating file names from the output file name mask via variables and appending the extension based on the selected file format. This routine did not deal with file.names.containing.extra. dots.

I had no problems with - included in file or folder names (as you state in your post above), since - is not processed in any way and has no special meaning in Windows file names.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook