mirror of
https://github.com/pdf2htmlEX/pdf2htmlEX.git
synced 2024-12-22 13:00:08 +00:00
data directory under Windows is located unde data in pdf2htmlEX.exe path by default
This commit is contained in:
parent
8c65a2826b
commit
d4d86ca3fe
@ -41,9 +41,11 @@ using namespace pdf2htmlEX;
|
||||
|
||||
Param param;
|
||||
ArgParser argparser;
|
||||
string data_dir;
|
||||
|
||||
#if defined(_WIN32)
|
||||
#ifdef _WIN32
|
||||
#include <errno.h>
|
||||
#include <libgen.h>
|
||||
char *mkdtemp(char *tempbuf) {
|
||||
int rand_value = 0;
|
||||
char* tempbase = NULL;
|
||||
@ -65,6 +67,7 @@ char *mkdtemp(char *tempbuf) {
|
||||
::CreateDirectory(tempbuf, NULL);
|
||||
return tempbuf;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void deprecated_font_suffix(const char * dummy = nullptr)
|
||||
@ -90,7 +93,11 @@ void show_version_and_exit(const char * dummy = nullptr)
|
||||
#if ENABLE_SVG
|
||||
cerr << " cairo " << cairo_version_string() << endl;
|
||||
#endif
|
||||
#ifdef _WIN32
|
||||
cerr << "Default data-dir: " << data_dir << endl;
|
||||
#else
|
||||
cerr << "Default data-dir: " << PDF2HTMLEX_DATA_PATH << endl;
|
||||
#endif
|
||||
cerr << "Supported image format:";
|
||||
#ifdef ENABLE_LIBPNG
|
||||
cerr << " png";
|
||||
@ -193,7 +200,11 @@ void parse_options (int argc, char **argv)
|
||||
|
||||
// misc.
|
||||
.add("clean-tmp", ¶m.clean_tmp, 1, "remove temporary files after conversion")
|
||||
#ifdef _WIN32
|
||||
.add("data-dir", ¶m.data_dir, data_dir, "specify data directory")
|
||||
#else
|
||||
.add("data-dir", ¶m.data_dir, PDF2HTMLEX_DATA_PATH, "specify data directory")
|
||||
#endif
|
||||
// TODO: css drawings are hidden on print, for annot links, need to fix it for other drawings
|
||||
// .add("css-draw", ¶m.css_draw, 0, "[experimental and unsupported] CSS drawing")
|
||||
.add("debug", ¶m.debug, 0, "print debugging information")
|
||||
@ -342,6 +353,15 @@ void check_param()
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
{
|
||||
// Under Windows, the default data_dir is under /data in the pdf2htmlEX directory
|
||||
stringstream ss;
|
||||
ss << dirname(argv[0]) << "/data";
|
||||
data_dir = ss.str();
|
||||
}
|
||||
#endif
|
||||
|
||||
parse_options(argc, argv);
|
||||
check_param();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user