Skip to main content

The Portable Namespace Reference

Definition

namespace Portable { ... }

Functions Index

intsystem (const QCString &command, const QCString &args, bool commandHasConsole=true)
uint32_tpid ()
QCStringgetenv (const QCString &variable)
voidsetenv (const QCString &variable, const QCString &value)
voidunsetenv (const QCString &variable)
FILE *fopen (const QCString &fileName, const QCString &mode)
intfclose (FILE *f)
voidunlink (const QCString &fileName)
QCStringpathSeparator ()
QCStringpathListSeparator ()
const char *ghostScriptCommand ()
const char *commandExtension ()
boolfileSystemIsCaseSensitive ()
FILE *popen (const QCString &name, const QCString &type)
intpclose (FILE *stream)
doublegetSysElapsedTime ()
boolisAbsolutePath (const QCString &fileName)
voidcorrectPath (const StringVector &list)

Correct a possible wrong PATH variable. More...

voidsetShortDir ()
const char *strnstr (const char *haystack, const char *needle, size_t haystack_len)
const char *devNull ()
boolcheckForExecutable (const QCString &fileName)
size_trecodeUtf8StringToW (const QCString &inputStr, uint16_t **buf)
std::ofstreamopenOutputStream (const QCString &name, bool append=false)
std::ifstreamopenInputStream (const QCString &name, bool binary=false, bool openAtEnd=false)

Functions

checkForExecutable()

bool Portable::checkForExecutable (const QCString & fileName)

Declaration at line 42 of file portable.h, definition at line 440 of file portable.cpp.

441{
442#if defined(_WIN32) && !defined(__CYGWIN__)
443 const char *extensions[] = {".bat",".com",".exe"};
444 for (int i = 0; i < sizeof(extensions) / sizeof(*extensions); i++)
445 {
446 if (ExistsOnPath(fileName + extensions[i])) return true;
447 }
448 return false;
449#else
450 return ExistsOnPath(fileName);
451#endif
452}

Reference ExistsOnPath.

Referenced by generateFormula.

commandExtension()

const char * Portable::commandExtension ()

Declaration at line 32 of file portable.h, definition at line 478 of file portable.cpp.

479{
480#if defined(_WIN32) && !defined(__CYGWIN__)
481 return ".exe";
482#else
483 return "";
484#endif
485}

Referenced by Config::checkAndCorrect, computeVerifiedDotPath and writeDiaGraphFromFile.

correctPath()

void Portable::correctPath (const StringVector & extraPaths)

Correct a possible wrong PATH variable.

This routine was inspired by the cause for bug 766059 was that in the Windows path there were forward slashes.

Declaration at line 38 of file portable.h, definition at line 533 of file portable.cpp.

533void Portable::correctPath(const StringVector &extraPaths)
534{
535 QCString p = Portable::getenv("PATH");
536 bool first=true;
537 QCString result;
538#if defined(_WIN32) && !defined(__CYGWIN__)
539 for (const auto &path : extraPaths)
540 {
541 if (!first) result+=';';
542 first=false;
543 result += substitute(QCString(path),"/","\\");
544 }
545 if (!result.isEmpty() && !p.isEmpty()) result+=';';
546 result += substitute(p,"/","\\");
547#else
548 for (const auto &path : extraPaths)
549 {
550 if (!first) result+=':';
551 first=false;
552 result += QCString(path);
553 }
554 if (!result.isEmpty() && !p.isEmpty()) result+=':';
555 result += p;
556#endif
557 if (result!=p) Portable::setenv("PATH",result.data());
558 //printf("settingPath(%s) #extraPaths=%zu\n",Portable::getenv("PATH").data(),extraPaths.size());
559}

References QCString::data, getenv, QCString::isEmpty, setenv and substitute.

Referenced by parseInput.

devNull()

const char * Portable::devNull ()

Declaration at line 41 of file portable.h, definition at line 631 of file portable.cpp.

631const char *Portable::devNull()
632{
633#if defined(_WIN32) && !defined(__CYGWIN__)
634 return "NUL";
635#else
636 return "/dev/null";
637#endif
638}

Referenced by createDVIFile, createSVGFromPDFviaInkscape and determineInkscapeVersion.

fclose()

int Portable::fclose (FILE * f)

Declaration at line 27 of file portable.h, definition at line 386 of file portable.cpp.

386int Portable::fclose(FILE *f)
387{
388 return ::fclose(f);
389}

Referenced by OutputGenerator::endPlainFile, finishWarnExit and initWarningFormat.

fileSystemIsCaseSensitive()

bool Portable::fileSystemIsCaseSensitive ()

Declaration at line 33 of file portable.h, definition at line 487 of file portable.cpp.

488{
489#if defined(_WIN32) || defined(macintosh) || defined(__MACOSX__) || defined(__APPLE__) || defined(__CYGWIN__)
490 return FALSE;
491#else
492 return TRUE;
493#endif
494}

References FALSE and TRUE.

Referenced by findFileDef, getCaseSenseNames and getFilterFromList.

fopen()

FILE * Portable::fopen (const QCString & fileName, const QCString & mode)

Declaration at line 26 of file portable.h, definition at line 366 of file portable.cpp.

366FILE *Portable::fopen(const QCString &fileName,const QCString &mode)
367{
368#if defined(_WIN32) && !defined(__CYGWIN__)
369 uint16_t *fn = nullptr;
370 size_t fn_len = recodeUtf8StringToW(fileName,&fn);
371 uint16_t *m = nullptr;
372 size_t m_len = recodeUtf8StringToW(mode,&m);
373 FILE *result = nullptr;
374 if (fn_len!=(size_t)-1 && m_len!=(size_t)-1)
375 {
376 result = _wfopen((wchar_t*)fn,(wchar_t*)m);
377 }
378 delete[] fn;
379 delete[] m;
380 return result;
381#else
382 return ::fopen(fileName.data(),mode.data());
383#endif
384}

References QCString::data and recodeUtf8StringToW.

Referenced by checkPngResult, FilterCache::getFileContentsPipe, initWarningFormat, DotRunner::run, OutputGenerator::startPlainFile and tryPath.

getenv()

QCString Portable::getenv (const QCString & variable)

Declaration at line 23 of file portable.h, definition at line 338 of file portable.cpp.

339{
340#if defined(_WIN32) && !defined(__CYGWIN__)
341 #define ENV_BUFSIZE 32768
342 LPTSTR pszVal = (LPTSTR) malloc(ENV_BUFSIZE*sizeof(TCHAR));
343 if (GetEnvironmentVariable(variable.data(),pszVal,ENV_BUFSIZE) == 0) return "";
344 QCString out;
345 out = pszVal;
346 free(pszVal);
347 return out;
348 #undef ENV_BUFSIZE
349#else
350 if(!environmentLoaded) // if the environment variables are not loaded already...
351 { // ...call loadEnvironment to store them in class
353 }
354
355 if (proc_env.find(variable.str()) != proc_env.end())
356 {
357 return QCString(proc_env[variable.str()]);
358 }
359 else
360 {
361 return QCString();
362 }
363#endif
364}

References QCString::data, environmentLoaded, loadEnvironment, proc_env and QCString::str.

Referenced by correctPath, ExistsOnPath, getCurrentDateTime, initDoxygen, parseInput, setDotFontPath and substEnvVarsInString.

getSysElapsedTime()

double Portable::getSysElapsedTime ()

Declaration at line 36 of file portable.h, definition at line 98 of file portable.cpp.

References SysTimeKeeper::elapsedTime and SysTimeKeeper::instance.

Referenced by generateOutput.

ghostScriptCommand()

const char * Portable::ghostScriptCommand ()

Declaration at line 31 of file portable.h, definition at line 454 of file portable.cpp.

455{
456#if defined(_WIN32) && !defined(__CYGWIN__)
457 static const char *gsexe = nullptr;
458 if (!gsexe)
459 {
460 const char *gsExec[] = {"gswin32c.exe","gswin64c.exe"};
461 for (int i = 0; i < sizeof(gsExec) / sizeof(*gsExec); i++)
462 {
463 if (ExistsOnPath(gsExec[i]))
464 {
465 gsexe = gsExec[i];
466 return gsexe;
467 }
468 }
469 gsexe = gsExec[0];
470 return gsexe;
471 }
472 return gsexe;
473#else
474 return "gs";
475#endif
476}

Reference ExistsOnPath.

Referenced by createCroppedEPS, createCroppedPDF, createEPSbboxFile, createPNG and writeMakeBat.

isAbsolutePath()

bool Portable::isAbsolutePath (const QCString & fileName)

Declaration at line 37 of file portable.h, definition at line 514 of file portable.cpp.

515{
516 const char *fn = fileName.data();
517# ifdef _WIN32
518 if (fileName.length()>1 && isalpha(fileName[0]) && fileName[1]==':') fn+=2;
519# endif
520 char const fst = fn[0];
521 if (fst == '/') return true;
522# ifdef _WIN32
523 if (fst == '\\') return true;
524# endif
525 return false;
526}

References QCString::data and QCString::length.

Referenced by findFile, findFile, generateOutput, Markdown::Private::processLink and readTextFileByName.

openInputStream()

std::ifstream Portable::openInputStream (const QCString & name, bool binary=false, bool openAtEnd=false)

Declaration at line 45 of file portable.h, definition at line 676 of file portable.cpp.

676std::ifstream Portable::openInputStream(const QCString &fileName,bool binary, bool openAtEnd)
677{
678 std::ios_base::openmode mode = std::ifstream::in | std::ifstream::binary;
679 if (binary) mode |= std::ios::binary;
680 if (openAtEnd) mode |= std::ios::ate;
681#if defined(__clang__) && defined(__MINGW32__)
682 return std::ifstream(fs::path(fileName.str()).wstring(), mode);
683#else
684 return std::ifstream(fs::path(fileName.str()), mode);
685#endif
686}

Reference QCString::str.

Referenced by configFileToString, convertMapFile, DotFilePatcher::convertMapFile, determineInkscapeVersion, finishWarnExit, CitationManager::generatePage, FormulaManager::initFromRepository, CitationManager::insertCrossReferencesForBibFile, Htags::loadFilemap, preProcessFile, DotRunner::readBoundingBox, FilterCache::readFragmentFromFile, readInputFile, readSVGSize, resetPDFSize, DotFilePatcher::run, sameMd5Signature, testRTFOutput and updateEPSBoundingBox.

openOutputStream()

std::ofstream Portable::openOutputStream (const QCString & name, bool append=false)

Declaration at line 44 of file portable.h, definition at line 665 of file portable.cpp.

665std::ofstream Portable::openOutputStream(const QCString &fileName,bool append)
666{
667 std::ios_base::openmode mode = std::ofstream::out | std::ofstream::binary;
668 if (append) mode |= std::ofstream::app;
669#if defined(__clang__) && defined(__MINGW32__)
670 return std::ofstream(fs::path(fileName.str()).wstring(), mode);
671#else
672 return std::ofstream(fs::path(fileName.str()), mode);
673#endif
674}

Reference QCString::str.

Referenced by Qhp::addContentsItem, ResourceMgr::copyResourceAs, FormulaManager::createFormulasTexFile, FormulaManager::createLatexFile, PerlModGenerator::createOutputFile, HtmlHelp::Private::createProjectFile, dumpSymbolMap, EclipseHelp::finalize, generateDEF, generateJSNavTree, generateJSTreeFiles, CitationManager::generatePage, generateXML, generateXMLForClass, generateXMLForConcept, generateXMLForDir, generateXMLForFile, generateXMLForGroup, generateXMLForModule, generateXMLForNamespace, generateXMLForPage, HtmlGenerator::init, Crawlmap::initialize, DocSets::initialize, EclipseHelp::initialize, HtmlHelp::initialize, Qhp::initialize, Sitemap::initialize, openOutputFile, DocbookDocVisitor::operator(), HtmlDocVisitor::operator(), LatexDocVisitor::operator(), RTFDocVisitor::operator(), DotGraph::prepareDotFile, RTFGenerator::preProcessFileInplace, resetPDFSize, DotFilePatcher::run, runPlantumlContent, ManGenerator::startDoxyAnchor, updateEPSBoundingBox, SearchIndex::write, SearchIndexExternal::write, ResourceMgr::writeCategory, writeCombineScript, HtmlGenerator::writeExternalSearchPage, ClassDiagram::writeFigure, FlowChart::writeFlowChart, writeJavascriptSearchData, writeJavaScriptSearchIndex, writeJavasScriptSearchDataPage, writeLatexMakefile, writeMakeBat, writeMenuData, HtmlGenerator::writeSearchData, HtmlGenerator::writeSearchPage and writeTagFile.

pathListSeparator()

QCString Portable::pathListSeparator ()

Declaration at line 30 of file portable.h, definition at line 400 of file portable.cpp.

401{
402#if defined(_WIN32) && !defined(__CYGWIN__)
403 return ";";
404#else
405 return ":";
406#endif
407}

Referenced by ExistsOnPath, parseInput, runPlantumlContent and setDotFontPath.

pathSeparator()

QCString Portable::pathSeparator ()

Declaration at line 29 of file portable.h, definition at line 391 of file portable.cpp.

392{
393#if defined(_WIN32) && !defined(__CYGWIN__)
394 return "\\";
395#else
396 return "/";
397#endif
398}

Referenced by Config::checkAndCorrect, ExistsOnPath, findFilePath, readTextFileByName, writeDiaGraphFromFile and writeMscGraphFromFile.

pclose()

int Portable::pclose (FILE * stream)

Declaration at line 35 of file portable.h, definition at line 505 of file portable.cpp.

505int Portable::pclose(FILE *stream)
506{
507 #if defined(_MSC_VER) || defined(__BORLANDC__)
508 return ::_pclose(stream);
509 #else
510 return ::pclose(stream);
511 #endif
512}

Referenced by FileDefImpl::acquireFileVersion, FilterCache::getFileContentsPipe, readInputFile, runQHelpGenerator and stackTrace.

pid()

uint32_t Portable::pid ()

Declaration at line 22 of file portable.h, definition at line 265 of file portable.cpp.

265uint32_t Portable::pid()
266{
267 uint32_t pid;
268#if !defined(_WIN32) || defined(__CYGWIN__)
269 pid = static_cast<uint32_t>(getpid());
270#else
271 pid = static_cast<uint32_t>(GetCurrentProcessId());
272#endif
273 return pid;
274}

Reference pid.

Referenced by initWarningFormat, parseInput, pid and system.

popen()

FILE * Portable::popen (const QCString & name, const QCString & type)

Declaration at line 34 of file portable.h, definition at line 496 of file portable.cpp.

496FILE * Portable::popen(const QCString &name,const QCString &type)
497{
498 #if defined(_MSC_VER) || defined(__BORLANDC__)
499 return ::_popen(name.data(),type.data());
500 #else
501 return ::popen(name.data(),type.data());
502 #endif
503}

Reference QCString::data.

Referenced by FileDefImpl::acquireFileVersion, FilterCache::getFileContentsPipe, readInputFile, runQHelpGenerator and stackTrace.

recodeUtf8StringToW()

size_t Portable::recodeUtf8StringToW (const QCString & inputStr, uint16_t ** buf)

Declaration at line 43 of file portable.h, definition at line 640 of file portable.cpp.

640size_t Portable::recodeUtf8StringToW(const QCString &inputStr,uint16_t **outBuf)
641{
642 if (inputStr.isEmpty() || outBuf==nullptr) return 0; // empty input or invalid output
643 void *handle = portable_iconv_open("UTF-16LE","UTF-8");
644 if (handle==reinterpret_cast<void *>(-1)) return 0; // invalid encoding
645 size_t len = inputStr.length();
646 uint16_t *buf = new uint16_t[len+1];
647 *outBuf = buf;
648 size_t inRemains = len;
649 size_t outRemains = len*sizeof(uint16_t)+2; // chars + \0
650 const char *p = inputStr.data();
651 portable_iconv(handle,&p,&inRemains,reinterpret_cast<char **>(&buf),&outRemains);
652 *buf=0;
654 return len;
655}

References QCString::data, QCString::isEmpty, QCString::length, portable_iconv, portable_iconv_close and portable_iconv_open.

Referenced by fopen and system.

setenv()

void Portable::setenv (const QCString & variable, const QCString & value)

Declaration at line 24 of file portable.h, definition at line 303 of file portable.cpp.

303void Portable::setenv(const QCString &name,const QCString &value)
304{
305#if defined(_WIN32) && !defined(__CYGWIN__)
306 SetEnvironmentVariable(name.data(),!value.isEmpty() ? value.data() : "");
307#else
308 if(!environmentLoaded) // if the environment variables are not loaded already...
309 { // ...call loadEnvironment to store them in class
311 }
312
313 proc_env[name.str()] = value.str(); // create or replace existing value
314 ::setenv(name.data(),value.data(),1);
315#endif
316}

References QCString::data, environmentLoaded, QCString::isEmpty, loadEnvironment, proc_env, setenv and QCString::str.

Referenced by correctPath, initDoxygen, parseInput, setDotFontPath, setenv and unsetDotFontPath.

setShortDir()

void Portable::setShortDir ()

Declaration at line 39 of file portable.h, definition at line 570 of file portable.cpp.

571{
572#if defined(_WIN32) && !defined(__CYGWIN__)
573 long length = 0;
574 TCHAR* buffer = nullptr;
575 // First obtain the size needed by passing nullptr and 0
576 length = GetShortPathName(Dir::currentDirPath().c_str(), nullptr, 0);
577 // Dynamically allocate the correct size
578 // (terminating null char was included in length)
579 buffer = new TCHAR[length];
580 // Now simply call again using same (long) path.
581 length = GetShortPathName(Dir::currentDirPath().c_str(), buffer, length);
582 // Set the correct directory (short name)
583 Dir::setCurrent(buffer);
584 delete [] buffer;
585#endif
586}

References Dir::currentDirPath and Dir::setCurrent.

Referenced by runHtmlHelpCompiler.

strnstr()

const char * Portable::strnstr (const char * haystack, const char * needle, size_t haystack_len)

Declaration at line 40 of file portable.h, definition at line 617 of file portable.cpp.

617const char *Portable::strnstr(const char *haystack, const char *needle, size_t haystack_len)
618{
619 size_t needle_len = strnlen(needle, haystack_len);
620 if (needle_len < haystack_len || !needle[needle_len])
621 {
622 const char *x = portable_memmem(haystack, haystack_len, needle, needle_len);
623 if (x && !memchr(haystack, 0, x - haystack))
624 {
625 return x;
626 }
627 }
628 return nullptr;
629}

Reference portable_memmem.

Referenced by Markdown::Private::addStrEscapeUtf8Nbsp.

system()

int Portable::system (const QCString & command, const QCString & args, bool commandHasConsole=true)

Declaration at line 21 of file portable.h, definition at line 106 of file portable.cpp.

106int Portable::system(const QCString &command,const QCString &args,bool commandHasConsole)
107{
108 if (command.isEmpty()) return 1;
109 AutoTimeKeeper timeKeeper;
110
111#if defined(_WIN32) && !defined(__CYGWIN__)
112 QCString commandCorrectedPath = substitute(command,'/','\\');
113 QCString fullCmd=commandCorrectedPath;
114#else
115 QCString fullCmd=command;
116#endif
117 fullCmd=fullCmd.stripWhiteSpace();
118 if (fullCmd.at(0)!='"' && fullCmd.find(' ')!=-1)
119 {
120 // add quotes around command as it contains spaces and is not quoted already
121 fullCmd="\""+fullCmd+"\"";
122 }
123 fullCmd += " ";
124 fullCmd += args;
125#ifndef NODEBUG
126 Debug::print(Debug::ExtCmd,0,"Executing external command `{}`\n",fullCmd);
127#endif
128
129#if !defined(_WIN32) || defined(__CYGWIN__)
130 (void)commandHasConsole;
131 /*! taken from the system() manpage on my Linux box */
132 int pid,status=0;
133
134#ifdef _OS_SOLARIS // for Solaris we use vfork since it is more memory efficient
135
136 // on Solaris fork() duplicates the memory usage
137 // so we use vfork instead
138
139 // spawn shell
140 if ((pid=vfork())<0)
141 {
142 status=-1;
143 }
144 else if (pid==0)
145 {
146 execl("/bin/sh","sh","-c",fullCmd.data(),(char*)0);
147 _exit(127);
148 }
149 else
150 {
151 while (waitpid(pid,&status,0 )<0)
152 {
153 if (errno!=EINTR)
154 {
155 status=-1;
156 break;
157 }
158 }
159 }
160 return status;
161
162#else // Other Unices just use fork
163
164 pid = fork();
165 if (pid==-1)
166 {
167 perror("fork error");
168 return -1;
169 }
170 if (pid==0)
171 {
172 const char * const argv[4] = { "sh", "-c", fullCmd.data(), 0 };
173 execve("/bin/sh",const_cast<char * const*>(argv),environ);
174 exit(127);
175 }
176 for (;;)
177 {
178 if (waitpid(pid,&status,0)==-1)
179 {
180 if (errno!=EINTR) return -1;
181 }
182 else
183 {
184 if (WIFEXITED(status))
185 {
186 return WEXITSTATUS(status);
187 }
188 else
189 {
190 return status;
191 }
192 }
193 }
194#endif // !_OS_SOLARIS
195
196#else // Win32 specific
197 if (commandHasConsole)
198 {
199 return ::system(fullCmd.data());
200 }
201 else
202 {
203 // Because ShellExecuteEx can delegate execution to Shell extensions
204 // (data sources, context menu handlers, verb implementations) that
205 // are activated using Component Object Model (COM), COM should be
206 // initialized before ShellExecuteEx is called. Some Shell extensions
207 // require the COM single-threaded apartment (STA) type.
208 // For that case COM is initialized as follows
209 CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE);
210
211 uint16_t *commandw = nullptr;
212 recodeUtf8StringToW( commandCorrectedPath, &commandw );
213 uint16_t *argsw = nullptr;
214 recodeUtf8StringToW( args, &argsw );
215
216 // gswin32 is a GUI api which will pop up a window and run
217 // asynchronously. To prevent both, we use ShellExecuteEx and
218 // WaitForSingleObject (thanks to Robert Golias for the code)
219
220 SHELLEXECUTEINFOW sInfo = {
221 sizeof(SHELLEXECUTEINFOW), /* structure size */
222 SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_NO_UI, /* tell us the process
223 * handle so we can wait till it's done |
224 * do not display msg box if error
225 */
226 nullptr, /* window handle */
227 nullptr, /* action to perform: open */
228 (LPCWSTR)commandw, /* file to execute */
229 (LPCWSTR)argsw, /* argument list */
230 nullptr, /* use current working dir */
231 SW_HIDE, /* minimize on start-up */
232 nullptr, /* application instance handle */
233 nullptr, /* ignored: id list */
234 nullptr, /* ignored: class name */
235 nullptr, /* ignored: key class */
236 0, /* ignored: hot key */
237 nullptr, /* ignored: icon */
238 nullptr /* resulting application handle */
239 };
240
241 if (!ShellExecuteExW(&sInfo))
242 {
243 delete[] commandw;
244 delete[] argsw;
245 return -1;
246 }
247 else if (sInfo.hProcess) /* executable was launched, wait for it to finish */
248 {
249 WaitForSingleObject(sInfo.hProcess,INFINITE);
250 /* get process exit code */
251 DWORD exitCode;
252 bool retval = GetExitCodeProcess(sInfo.hProcess,&exitCode);
253 CloseHandle(sInfo.hProcess);
254 delete[] commandw;
255 delete[] argsw;
256 if (!retval) return -1;
257 return exitCode;
258 }
259 }
260#endif
261 return 1; // we should never get here
262
263}

References QCString::at, QCString::data, environ, Debug::ExtCmd, QCString::find, QCString::isEmpty, pid, Debug::print, recodeUtf8StringToW, QCString::stripWhiteSpace and substitute.

Referenced by createCroppedEPS, createCroppedPDF, createDVIFile, createEPSbboxFile, createPNG, createPostscriptFile, FlowChart::createSVG, createSVGFromPDF, createSVGFromPDFviaInkscape, determineInkscapeVersion, do_mscgen_generate, Htags::execute, DocParser::findAndCopyImage, CitationManager::generatePage, DotRunner::run, runHtmlHelpCompiler, runPlantumlContent, runQHelpGenerator, writeDiaGraphFromFile, ClassDiagram::writeFigure and writeMscGraphFromFile.

unlink()

void Portable::unlink (const QCString & fileName)

Declaration at line 28 of file portable.h, definition at line 561 of file portable.cpp.

561void Portable::unlink(const QCString &fileName)
562{
563#if defined(_WIN32) && !defined(__CYGWIN__)
564 _unlink(fileName.data());
565#else
566 ::unlink(fileName.data());
567#endif
568}

References QCString::data and unlink.

Referenced by finishWarnExit, RTFGenerator::preProcessFileInplace, DotRunner::run and unlink.

unsetenv()

void Portable::unsetenv (const QCString & variable)

Declaration at line 25 of file portable.h, definition at line 318 of file portable.cpp.

318void Portable::unsetenv(const QCString &variable)
319{
320#if defined(_WIN32) && !defined(__CYGWIN__)
321 SetEnvironmentVariable(variable.data(),nullptr);
322#else
323 /* Some systems don't have unsetenv(), so we do it ourselves */
324 if (variable.isEmpty() || variable.find('=')!=-1)
325 {
326 return; // not properly formatted
327 }
328
329 auto it = proc_env.find(variable.str());
330 if (it != proc_env.end())
331 {
332 proc_env.erase(it);
333 ::unsetenv(variable.data());
334 }
335#endif
336}

References QCString::data, QCString::find, QCString::isEmpty, proc_env, QCString::str and unsetenv.

Referenced by setDotFontPath, unsetDotFontPath and unsetenv.


The documentation for this namespace was generated from the following files:


Generated via doxygen2docusaurus by Doxygen 1.14.0.