Skip to content

Commit

Permalink
issue #9007 Using DOT_PATH with a symlink for dot does not always wor…
Browse files Browse the repository at this point in the history
…k (plantuml)

Regression as mentioned in #9007 (comment)
The graphvizdot cannot just contain the name of an executable somewhere in the path but needs a relative or full path.
So just when having no explicit `DOT_PATH` set just setting the command `dot` won't work as plantuml won't resolve the path.
  • Loading branch information
albert-github committed Jan 8, 2022
1 parent b0a910e commit 1704361
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 1 deletion.
5 changes: 5 additions & 0 deletions src/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,11 @@ namespace Config

/*! Clean up any data */
void deinit();

/*! Signal whether or not the DOT_PATH is explicitly set. plantuml needs either a full or
* relative path to the dot executable
*/
bool getPlantumlDotPathSet();
}

#endif
15 changes: 15 additions & 0 deletions src/configimpl.h
Original file line number Diff line number Diff line change
Expand Up @@ -583,6 +583,20 @@ class ConfigImpl
return substitute(result,"\r","");
}

/*! Signal whether or not the DOT_PATH is explicitly set. plantuml needs either a full or
* relative path to the dot executable
*/
bool getPlantumlDotPathSet()
{
return m_plantumlDotPathSet;
}

/*! setter function for m_plantumlDotPathSet */
void setPlantumlDotPathSet(bool f)
{
m_plantumlDotPathSet = f;
}

protected:

ConfigImpl()
Expand All @@ -604,6 +618,7 @@ class ConfigImpl
QCString m_userComment;
bool m_initialized;
QCString m_header;
bool m_plantumlDotPathSet = false;
};

#endif
9 changes: 9 additions & 0 deletions src/configimpl.l
Original file line number Diff line number Diff line change
Expand Up @@ -1853,6 +1853,7 @@ void Config::checkAndCorrect(bool quiet, const bool check)
//------------------------
// check dot path
QCString dotPath = Config_getString(DOT_PATH);
bool plantumlDotPathSet = true;
if (!dotPath.isEmpty())
{
FileInfo fi(dotPath.str());
Expand All @@ -1863,6 +1864,7 @@ void Config::checkAndCorrect(bool quiet, const bool check)
if (!dp.exists() || !dp.isFile())
{
warn_uncond("the dot tool could not be found as '%s'\n",qPrint(dotPath));
plantumlDotPathSet = false;
dotPath = "dot";
dotPath += Portable::commandExtension();
}
Expand All @@ -1874,10 +1876,12 @@ void Config::checkAndCorrect(bool quiet, const bool check)
}
else
{
plantumlDotPathSet = false;
dotPath = "dot";
dotPath += Portable::commandExtension();
}
Config_updateString(DOT_PATH,dotPath);
ConfigImpl::instance()->setPlantumlDotPathSet(plantumlDotPathSet);

//------------------------
// check plantuml path
Expand Down Expand Up @@ -2102,6 +2106,11 @@ void Config::writeXMLDoxyfile(TextStream &t)
ConfigImpl::instance()->writeXMLDoxyfile(t);
}

bool Config::getPlantumlDotPathSet()
{
return ConfigImpl::instance()->getPlantumlDotPathSet();
}

bool Config::parse(const QCString &fileName,bool update)
{
bool parseRes = ConfigImpl::instance()->parse(fileName,update);
Expand Down
2 changes: 1 addition & 1 deletion src/plantuml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ static void runPlantumlContent(const PlantumlManager::FilesMap &plantumlFiles,
pumlArgs += plantumlConfigFile;
pumlArgs += "\" ";
}
if (Config_getBool(HAVE_DOT) && !dotPath.isEmpty())
if (Config_getBool(HAVE_DOT) && Config::getPlantumlDotPathSet() && !dotPath.isEmpty())
{
pumlArgs += "-graphvizdot \"";
pumlArgs += dotPath;
Expand Down

0 comments on commit 1704361

Please sign in to comment.