-
Notifications
You must be signed in to change notification settings - Fork 19
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
[WIP] TeX Live patches for Windows #21
Changes from all commits
a4e08ae
33a4cba
9a2f1db
b5dd08d
7cc3b38
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -39,7 +39,9 @@ | |
#include <algorithm> | ||
|
||
#ifdef WIN32 | ||
# define mkdir(dir, access) mkdir(dir) | ||
# include <io.h> | ||
# include <direct.h> | ||
# define mkdir(dir, access) _mkdir(dir) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't object to this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kakuto:
|
||
# define COPY_CMD "copy" | ||
# define CMD_SEP "&" | ||
#else | ||
|
@@ -124,7 +126,16 @@ look_for_writable_texdir(const char *path_variable, bool create) | |
static void | ||
find_writable_texdir(ErrorHandler *errh, const char *) | ||
{ | ||
look_for_writable_texdir("$TEXMFVAR", true); | ||
// Check if TEXMFVAR is writable. | ||
// Some distributions like W32TeX do not have TEXMFVAR defined, | ||
// in which case we check TEXMFLOCAL. | ||
char *p = kpsei_var_value("TEXMFVAR"); | ||
if (p == NULL) | ||
look_for_writable_texdir("$TEXMFLOCAL", true); | ||
else { | ||
free (p); | ||
look_for_writable_texdir("$TEXMFVAR", true); | ||
} | ||
if (!writable_texdir) | ||
look_for_writable_texdir("$VARTEXMF", false); | ||
if (!writable_texdir) | ||
|
@@ -313,7 +324,7 @@ update_odir(int o, String file, ErrorHandler *errh) | |
String ls_r = writable_texdir + "ls-R"; | ||
bool success = false; | ||
if (access(ls_r.c_str(), R_OK) >= 0) // make sure it already exists | ||
if (FILE *f = fopen(ls_r.c_str(), "a")) { | ||
if (FILE *f = fopen(ls_r.c_str(), "ab")) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are all files being made binary? Is there an actual concrete reason? Because this is just a text file. But maybe on Windows all kpathsea files such as There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kakuto:
|
||
fprintf(f, "./%s:\n%s\n", directory.c_str(), file.c_str()); | ||
success = true; | ||
fclose(f); | ||
|
@@ -323,7 +334,11 @@ update_odir(int o, String file, ErrorHandler *errh) | |
if (!success && writable_texdir.find_left('\'') < 0 && directory.find_left('\'') < 0 && file.find_left('\'') < 0) { | ||
// look for mktexupd script | ||
if (!mktexupd_tried) { | ||
#ifdef _WIN32 | ||
mktexupd = "mktexupd.exe"; | ||
#else | ||
mktexupd = kpsei_string(kpsei_find_file("mktexupd", KPSEI_FMT_WEB2C)); | ||
#endif | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK (shrug) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kakuto:
|
||
mktexupd_tried = true; | ||
} | ||
|
||
|
@@ -677,7 +692,7 @@ update_autofont_map(const String &fontname, String mapline, ErrorHandler *errh) | |
#endif | ||
{ | ||
fclose(f); | ||
f = fopen(map_file.c_str(), "w"); | ||
f = fopen(map_file.c_str(), "wb"); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kakuto:
|
||
fd = fileno(f); | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -410,10 +410,10 @@ particular purpose.\n"); | |
// write it to output | ||
if (!outputf) | ||
outputf = stdout; | ||
if (binary) { | ||
#if defined(_MSDOS) || defined(_WIN32) | ||
_setmode(_fileno(outputf), _O_BINARY); | ||
_setmode(_fileno(outputf), _O_BINARY); | ||
#endif | ||
if (binary) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above... There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Kakuto:
|
||
Type1PFBWriter w(outputf); | ||
dotless_font->write(w); | ||
} else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I assume this would not hurt even if defined immediately under WIN32. It's just that under VS it isn't really needed.