protz / LatexIt

An extension for Thunderbird that allows you to generate LaTeX in your emails and send it as inline images
http://www.xulforum.org/go_code
37 stars 16 forks source link

Add option to set the temporary directory path on Windows. Also a few smaller changes. #86

Closed MaxKoll closed 3 years ago

MaxKoll commented 3 years ago

Hey,

I ran into the same issue as described in #15, #32 and #56 (even after #81 & #82). So I started digging and came up with a solution/workaround.

What's the problem?

As of May 2020, MiKTeX does no longer support short filenames (aka 8.3 filenames). Unfortunately in my case the path to the temporary directory as given by Cc["@mozilla.org/file/directory_service;1"].getService(Ci.nsIProperties).get("TmpD", Ci.nsIFile).path includes short filenames. If I run the command that LaTeX It! shows in the debug box manually (with the paths adjusted), everything works fine.

What I considered:

I tried finding a reasonable way to extract the full path in the given framework, but had no success:

Also, I haven't found a way to pass a working/execution directory to nsIProcess. Otherwise you could just launch the executables from the temporary directory.

What I came up with:

I added the option to change the path of the temporary directory. This setting is only used and shown on Windows.

During this I discovered a few other issues that I also tackled:

I tested my changes on:

On these systems, everything seems to work fine. I don't have the possibility to test on OS X.

If some or all of these changes are desirable, please feel free to use them any way you like. Please tell me if you want this PR split up.

Max

MaxKoll commented 3 years ago

I think I found a better way to do this:

Don't call latex.exe directly but via shell (same as with dvipng.exe), and change into the temporary directory first by prefixing the command with cd /d [temp_path] &&. I already tried it and it seems to work as expected. No need to set the temporary directory manually.

I will soon open another PR with the proposed changes.

Also, I realize, I should have pushed these changes to a separate branch associated with this PR. If I close this PR, is it still tracking changes to my forked mailextension branch? (I hope not.)

sphh commented 3 years ago

Do those two help pages help?

  1. https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/closing-a-pull-request
  2. https://docs.github.com/en/github/collaborating-with-issues-and-pull-requests/changing-the-base-branch-of-a-pull-request

I believe the brûte force way is to close the pull request, delete your fork (that's somewhere in the settings of your fork) and start again from square one ;-)

MaxKoll commented 3 years ago

Thanks! I will close this now and then reset my mailextension branch, which will hopefully lock this PR's state. Fingers crossed. :-)