Skip to content

Commit

Permalink
Fix output_directory (#785)
Browse files Browse the repository at this point in the history
  • Loading branch information
edocevoli committed Jun 2, 2021
1 parent 88f5538 commit 6be81c3
Show file tree
Hide file tree
Showing 11 changed files with 45 additions and 35 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -19,6 +19,7 @@ picker (`<Random package repository on the Internet>`) always chooses a secure U
- [765](https://github.com/MiKTeX/miktex/issues/765): MiKTeX 21.3 / pdflatex crashes sometimes after compiling LaTeX documents
- [768](https://github.com/MiKTeX/miktex/issues/768): kpsewhich with option --all
- [780](https://github.com/MiKTeX/miktex/issues/780): [MikTeX Portable] Can't remove local texmf directory
- [785](https://github.com/MiKTeX/miktex/issues/785): Create all auxiliary files in the directory specified by -aux-directory without ever writing in the source directory
- [825](https://github.com/MiKTeX/miktex/issues/825): wrong search path for lua files with lualatex-dev
- [833](https://github.com/MiKTeX/miktex/issues/833): Package downloader chooses insecure random mirrors

Expand Down
@@ -1,6 +1,6 @@
/* miktex/TeXAndFriends/WebAppInputLine.h: -*- C++ -*-
Copyright (C) 1996-2020 Christian Schenk
Copyright (C) 1996-2021 Christian Schenk
This file is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
Expand Down Expand Up @@ -97,8 +97,7 @@ class MIKTEXMFTYPEAPI(WebAppInputLine) :
public:
static WebAppInputLine* GetWebAppInputLine()
{
MIKTEX_ASSERT(dynamic_cast<WebAppInputLine*>(Application::GetApplication()) != nullptr);
return (WebAppInputLine*)Application::GetApplication();
return dynamic_cast<WebAppInputLine*>(Application::GetApplication());
}

public:
Expand Down
2 changes: 1 addition & 1 deletion Libraries/MiKTeX/TeXAndFriends/version.cmake
Expand Up @@ -21,4 +21,4 @@ set(MIKTEX_COMP_INTERFACE_VERSION 6)

set(MIKTEX_COMP_MAJOR_VERSION 4)
set(MIKTEX_COMP_MINOR_VERSION 5)
set(MIKTEX_COMP_PATCH_VERSION 0)
set(MIKTEX_COMP_PATCH_VERSION 1)
8 changes: 2 additions & 6 deletions Libraries/MiKTeX/Web2CEmulation/include/lib/lib.h
@@ -1,6 +1,6 @@
/* lib/lib.h: -*- C++ -*-
Copyright (C) 2013-2020 Christian Schenk
Copyright (C) 2013-2021 Christian Schenk
This file is part of the MiKTeX W2CEMU Library.
Expand Down Expand Up @@ -117,11 +117,7 @@ static inline void recorder_record_output(const char* fname)
}
#endif

#if defined(__cplusplus)
# define output_directory (MiKTeX::Web2C::GetOutputDirectory().Empty() ? nullptr : MiKTeX::Web2C::GetOutputDirectory().GetData())
#else
# define output_directory miktex_web2c_get_output_directory()
#endif
#define output_directory miktex_web2c_get_output_directory()

#if defined(__cplusplus)
#else
Expand Down
4 changes: 2 additions & 2 deletions Libraries/MiKTeX/Web2CEmulation/version.cmake
@@ -1,6 +1,6 @@
## version.cmake:
##
## Copyright (C) 2016-2020 Christian Schenk
## Copyright (C) 2016-2021 Christian Schenk
##
## This file is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
Expand All @@ -20,5 +20,5 @@
set(MIKTEX_COMP_INTERFACE_VERSION 2)

set(MIKTEX_COMP_MAJOR_VERSION 4)
set(MIKTEX_COMP_MINOR_VERSION 0)
set(MIKTEX_COMP_MINOR_VERSION 1)
set(MIKTEX_COMP_PATCH_VERSION 0)
24 changes: 22 additions & 2 deletions Libraries/MiKTeX/Web2CEmulation/w2cemu.cpp
Expand Up @@ -103,6 +103,7 @@ static FILE* TryFOpen(const char* path, const char* modeString)

int Web2C::OpenInput(FILE** ppfile, kpse_file_format_type format, const char* modeString)
{
MIKTEX_ASSERT(WebAppInputLine::GetWebAppInputLine() != nullptr);
PathName fileName(WebAppInputLine::GetWebAppInputLine()->GetNameOfFile());
char* path = miktex_kpathsea_find_file(kpse_def, fileName.GetData(), format, 0);
if (path == nullptr)
Expand All @@ -120,6 +121,7 @@ int Web2C::OpenInput(FILE** ppfile, kpse_file_format_type format, const char* mo
}
if (*ppfile != nullptr)
{
MIKTEX_ASSERT(WebAppInputLine::GetWebAppInputLine() != nullptr);
WebAppInputLine::GetWebAppInputLine()->SetNameOfFile(PathName(path));
}
MIKTEX_FREE(path);
Expand Down Expand Up @@ -177,6 +179,12 @@ void Web2C::SetOutputDirectory(const PathName& path)
}
#endif
session->AddInputDirectory(outputDirectory, true);
auto app = WebAppInputLine::GetWebAppInputLine();
if (app == nullptr)
{
return;
}
app->SetOutputDirectory(outputDirectory);
}

void miktex_web2c_set_output_directory(const char* path)
Expand All @@ -186,12 +194,23 @@ void miktex_web2c_set_output_directory(const char* path)

PathName Web2C::GetOutputDirectory()
{
return outputDirectory;
auto dir = miktex_web2c_get_output_directory();
if (dir == nullptr)
{
return PathName();
}
return PathName(dir);
}

const char* miktex_web2c_get_output_directory()
{
return outputDirectory.Empty() ? nullptr : outputDirectory.GetData();
auto app = WebAppInputLine::GetWebAppInputLine();
if (app == nullptr)
{
return outputDirectory.Empty() ? nullptr : outputDirectory.GetData();
}
auto outDir = app->GetOutputDirectory();
return outDir.Empty() ? nullptr : outDir.GetData();;
}

void Web2C::GetSecondsAndMicros(int* seconds, int* micros)
Expand Down Expand Up @@ -306,6 +325,7 @@ void miktex_usagehelp(const char** lines, const char* bugEmail)

char* Web2C::GetCurrentFileName()
{
MIKTEX_ASSERT(WebAppInputLine::GetWebAppInputLine() != nullptr);
return xstrdup(WebAppInputLine::GetWebAppInputLine()->GetFoundFileFq().GetData());
}

Expand Down
8 changes: 4 additions & 4 deletions Programs/TeXAndFriends/pdftex/po/de/miktex-pdftex.po
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: work 3\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-06 11:42+0100\n"
"POT-Creation-Date: 2021-06-02 19:34+0200\n"
"PO-Revision-Date: 2021-01-06 11:46+0100\n"
"Last-Translator: Christian Schenk <cs@miktex.org>\n"
"Language-Team: German\n"
Expand All @@ -17,14 +17,14 @@ msgstr ""
"Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=2; plural=(n != 1);\n"

#: pdftex-miktex.h:219
#: pdftex-miktex.h:219 pdftex-miktex.h:221
msgid "Switch on draft mode (generates no output)."
msgstr "Aktiviere Entwurfsmodus (erzeugt keine Ausgabe)."

#: pdftex-miktex.h:220
#: pdftex-miktex.h:220 pdftex-miktex.h:222
msgid "Set the output format."
msgstr "Setze das Ausgabeformat."

#: pdftex-miktex.h:245
#: pdftex-miktex.h:245 pdftex-miktex.h:247
msgid "Unknown output format value."
msgstr "Unbekannter Ausgabeformat-Wert."
8 changes: 4 additions & 4 deletions Programs/TeXAndFriends/pdftex/po/miktex-pdftex.pot
Expand Up @@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-06 11:42+0100\n"
"POT-Creation-Date: 2021-06-02 21:39+0200\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -17,14 +17,14 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: pdftex-miktex.h:219
#: pdftex-miktex.h:219 pdftex-miktex.h:221
msgid "Switch on draft mode (generates no output)."
msgstr ""

#: pdftex-miktex.h:220
#: pdftex-miktex.h:220 pdftex-miktex.h:222
msgid "Set the output format."
msgstr ""

#: pdftex-miktex.h:245
#: pdftex-miktex.h:245 pdftex-miktex.h:247
msgid "Unknown output format value."
msgstr ""
8 changes: 4 additions & 4 deletions Programs/TeXAndFriends/pdftex/po/zh_CN/miktex-pdftex.po
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: MiKTeX 21.1\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2021-01-06 11:42+0100\n"
"POT-Creation-Date: 2021-06-02 19:35+0200\n"
"PO-Revision-Date: 2021-01-28 12:18+0100\n"
"Last-Translator: Christian Schenk <cs@miktex.org>\n"
"Language-Team: Chinese (simplified)\n"
Expand All @@ -16,17 +16,17 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"

#: pdftex-miktex.h:219
#: pdftex-miktex.h:219 pdftex-miktex.h:221
#, fuzzy
msgid "Switch on draft mode (generates no output)."
msgstr "切换到草稿模式(不生成输出)。"

#: pdftex-miktex.h:220
#: pdftex-miktex.h:220 pdftex-miktex.h:222
#, fuzzy
msgid "Set the output format."
msgstr "设置输出格式。"

#: pdftex-miktex.h:245
#: pdftex-miktex.h:245 pdftex-miktex.h:247
#, fuzzy
msgid "Unknown output format value."
msgstr "未知的输出格式值。"
8 changes: 1 addition & 7 deletions Programs/TeXAndFriends/synctex/source/synctex.c
Expand Up @@ -421,7 +421,7 @@ static int fsyscp_remove(char *name);
# include "zlib.h"

#if defined(MIKTEX)
# include <miktex/W2C/Emulation.h> /* output_directory */
#include <miktex/W2C/Emulation.h> /* output_directory */
#endif
typedef void (*synctex_recorder_t) (halfword); /* recorders know how to record a node */
typedef int (*synctex_fprintf_t) (void *, const char *, ...); /* print formatted to either FILE * or gzFile */
Expand Down Expand Up @@ -946,12 +946,6 @@ void synctexterminate(boolean log_opened)
# endif
if (log_opened && (tmp = SYNCTEX_GET_LOG_NAME())) {
/* In version 1, the jobname was used but it caused problems regarding spaces in file names. */
#if defined(MIKTEX) && (defined(MIKTEX_PDFTEX) || defined(MIKTEX_XETEX))
MiKTeX::Util::PathName path = MiKTeX::TeXAndFriends::WebAppInputLine::GetWebAppInputLine()->GetOutputDirectory();
path /= MiKTeX::Util::PathName(tmp).RemoveDirectorySpec();
tmp = (char*)xrealloc(tmp, path.GetLength() + 1);
strcpy(tmp, path.GetData());
#endif
#if defined(MIKTEX) && defined(__cplusplus)
/* C++: typecast needed */
the_real_syncname = (char*)
Expand Down
4 changes: 2 additions & 2 deletions Programs/TeXAndFriends/synctex/version.cmake
@@ -1,6 +1,6 @@
## version.cmake:
##
## Copyright (C) 2017-2020 Christian Schenk
## Copyright (C) 2017-2021 Christian Schenk
##
## This file is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
Expand All @@ -20,7 +20,7 @@
set(MIKTEX_COMP_ORIG_VERSION_STR "1.5")

set(MIKTEX_COMP_MAJOR_VERSION 4)
set(MIKTEX_COMP_MINOR_VERSION 0)
set(MIKTEX_COMP_MINOR_VERSION 1)
set(MIKTEX_COMP_PATCH_VERSION 0)

set(MIKTEX_COMP_COPYRIGHT_STR "© 2008-2017 Jérôme Laurens")

0 comments on commit 6be81c3

Please sign in to comment.