Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update ShellOpen to handle versioned files; add ShellOpen into SEE-PDF in place of MacOS-specific open. #1410

Merged
merged 4 commits into from
Nov 11, 2023

Conversation

fghalasz
Copy link
Member

This PR fixes the issue where ShellOpen did not work with versioned files because the .N at the end of versioned files (on the unix filesystem) interfered with the openers' attempt to determine filetype based on the extension.

ShellOpen handles versioned files as follows:

  1. If a version is specified in the given filename, then the file is copied to /tmp/<random#> using the filename filename~<version>~.extension. Example foo.pdf;3 becomes foo~3~.pdf. The file is then opened from this tmp file.
  2. If no version is specified but there is no non-versioned file in the unix filesystem, then the highest numbered version will be used and copied as above.
  3. If no version is specified and there is a no-versioned file in the unix filesystem, then that no-versioned file is used with no copying to /tmp.

I was not able to use Ron's suggestion of foo\;3.pdf since it cause too many issues on several platforms - including in using COPYFILE inside Medley.

Also, could not use symbolic links instead of copying the file to /tmp since symbolic links don't work well with WSL (wslview) and Cygwin (cygstart).

This PR also fixes PDF-SEE to use ShellOpen instead of the MacOS-specific open.

Tested on WSL, Ubuntu Linux, MacOS, and Cygwin.

…specific calls; update how PDFCONVERTER is set to fix bug whereby it was always ps2pdf
…s copied to tmp and its filename is changed from foo.pdf;25 to foo~25~.pdf and this tmp is passed to the opener instead of the original file. This is so that the extension is preserved as the last thing when there are versions. The extension as the last thing is used by most openers to determine the file type.
Copy link
Member

@masinter masinter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Assumed tested, but works for me. Will merge this and fix up the HELPSYS PR if needed.

@masinter masinter merged commit c62c183 into master Nov 11, 2023
8 checks passed
@masinter masinter deleted the fgh_PDFSTREAM-Updates branch December 2, 2023 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants