Skip to content

Commit 4d173a0

Browse files
committed
HHC and directory elements starting with "."
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.
1 parent d4a0825 commit 4d173a0

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

src/doxygen.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11862,6 +11862,7 @@ void generateOutput()
1186211862
g_s.begin("Running html help compiler...\n");
1186311863
QString oldDir = QDir::currentDirPath();
1186411864
QDir::setCurrent(Config_getString(HTML_OUTPUT));
11865+
portable_setShortDir();
1186511866
portable_sysTimerStart();
1186611867
if (portable_system(Config_getString(HHC_LOCATION), "index.hhp", Debug::isFlagSet(Debug::ExtCmd))!=1)
1186711868
{

src/portable.cpp

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,3 +478,20 @@ void portable_unlink(const char *fileName)
478478
#endif
479479
}
480480

481+
void portable_setShortDir(void)
482+
{
483+
#if defined(_WIN32) && !defined(__CYGWIN__)
484+
long length = 0;
485+
TCHAR* buffer = NULL;
486+
// First obtain the size needed by passing NULL and 0.
487+
length = GetShortPathName(QDir::currentDirPath().data(), NULL, 0);
488+
// Dynamically allocate the correct size
489+
// (terminating null char was included in length)
490+
buffer = new TCHAR[length];
491+
// Now simply call again using same (long) path.
492+
length = GetShortPathName(QDir::currentDirPath().data(), buffer, length);
493+
// Set the correct directory (short name)
494+
QDir::setCurrent(buffer);
495+
delete [] buffer;
496+
#endif
497+
}

src/portable.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#include <sys/types.h>
55
#include <stdio.h>
66
#include <qglobal.h>
7+
#include <qdir.h>
78

89
#if defined(_WIN32)
910
typedef __int64 portable_off_t;
@@ -37,6 +38,7 @@ double portable_getSysElapsedTime();
3738
void portable_sleep(int ms);
3839
bool portable_isAbsolutePath(const char *fileName);
3940
void portable_correct_path(void);
41+
void portable_setShortDir(void);
4042

4143
extern "C" {
4244
void * portable_iconv_open(const char* tocode, const char* fromcode);

0 commit comments

Comments
 (0)