Skip to content

Commit

Permalink
HHC and directory elements starting with "."
Browse files Browse the repository at this point in the history
Based on the question 'Doxygen failed to run html help compiler, hhc.exe error HHC5010 when running from folder that has a parent folder that starts with “.”/ (https://stackoverflow.com/questions/58861908/doxygen-failed-to-run-html-help-compiler-hhc-exe-error-hhc5010-when-running-fro).

In we https://social.msdn.microsoft.com/Forums/en-US/0681145c-223b-498c-b7bf-be83209cbf4e/issue-with-html-workshop-in-a-windows-container?forum=visualstudiogeneral see:
HTML Help 1.x command line compiler hhc.exe cannot compile CHM file to folder whose full path contains folder name starting with dot. If you have that problem, you probably specified output path with folder starting with dot, e.g. "d:\My files.NET\documentation". You can use dots in folder names but not at the beginning.

We first convert the current path to a short name path and set this as current directory, this is only done on Windows other systems are not touched.
  • Loading branch information
albert-github committed Nov 15, 2019
1 parent d4a0825 commit 4d173a0
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/doxygen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11862,6 +11862,7 @@ void generateOutput()
g_s.begin("Running html help compiler...\n");
QString oldDir = QDir::currentDirPath();
QDir::setCurrent(Config_getString(HTML_OUTPUT));
portable_setShortDir();
portable_sysTimerStart();
if (portable_system(Config_getString(HHC_LOCATION), "index.hhp", Debug::isFlagSet(Debug::ExtCmd))!=1)
{
Expand Down
17 changes: 17 additions & 0 deletions src/portable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,3 +478,20 @@ void portable_unlink(const char *fileName)
#endif
}

void portable_setShortDir(void)
{
#if defined(_WIN32) && !defined(__CYGWIN__)
long length = 0;
TCHAR* buffer = NULL;
// First obtain the size needed by passing NULL and 0.
length = GetShortPathName(QDir::currentDirPath().data(), NULL, 0);
// Dynamically allocate the correct size
// (terminating null char was included in length)
buffer = new TCHAR[length];
// Now simply call again using same (long) path.
length = GetShortPathName(QDir::currentDirPath().data(), buffer, length);
// Set the correct directory (short name)
QDir::setCurrent(buffer);
delete [] buffer;
#endif
}
2 changes: 2 additions & 0 deletions src/portable.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <sys/types.h>
#include <stdio.h>
#include <qglobal.h>
#include <qdir.h>

#if defined(_WIN32)
typedef __int64 portable_off_t;
Expand Down Expand Up @@ -37,6 +38,7 @@ double portable_getSysElapsedTime();
void portable_sleep(int ms);
bool portable_isAbsolutePath(const char *fileName);
void portable_correct_path(void);
void portable_setShortDir(void);

extern "C" {
void * portable_iconv_open(const char* tocode, const char* fromcode);
Expand Down

0 comments on commit 4d173a0

Please sign in to comment.