diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2018-07-17 17:38:40 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2018-07-17 17:38:40 (GMT) |
commit | 352283e97798e916efb2e7af59ae608bb6e809b0 (patch) | |
tree | f42aaba921fadc8f63651ebe1b07c0e5265800b8 /src/portable.cpp | |
parent | 400b3168c2ca7b113331af2bd5e96092354b8724 (diff) | |
parent | bd6c93b2d26a9a80df66a25404613e285ef35815 (diff) | |
download | Doxygen-352283e97798e916efb2e7af59ae608bb6e809b0.zip Doxygen-352283e97798e916efb2e7af59ae608bb6e809b0.tar.gz Doxygen-352283e97798e916efb2e7af59ae608bb6e809b0.tar.bz2 |
Merge branch 'albert-github-feature/bug_extcmd_path'
Diffstat (limited to 'src/portable.cpp')
-rw-r--r-- | src/portable.cpp | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/portable.cpp b/src/portable.cpp index 4ad88a4..b4417c2 100644 --- a/src/portable.cpp +++ b/src/portable.cpp @@ -35,7 +35,12 @@ int portable_system(const char *command,const char *args,bool commandHasConsole) if (command==0) return 1; +#if defined(_WIN32) && !defined(__CYGWIN__) + QCString commandCorrectedPath = substitute(command,'/','\\'); + QCString fullCmd=commandCorrectedPath; +#else QCString fullCmd=command; +#endif fullCmd=fullCmd.stripWhiteSpace(); if (fullCmd.at(0)!='"' && fullCmd.find(' ')!=-1) { @@ -134,7 +139,7 @@ int portable_system(const char *command,const char *args,bool commandHasConsole) // For that case COM is initialized as follows CoInitializeEx(NULL, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DDE); - QString commandw = QString::fromUtf8( command ); + QString commandw = QString::fromUtf8( commandCorrectedPath ); QString argsw = QString::fromUtf8( args ); // gswin32 is a GUI api which will pop up a window and run @@ -458,18 +463,7 @@ void portable_correct_path(void) { #if defined(_WIN32) && !defined(__CYGWIN__) const char *p = portable_getenv("PATH"); - char *q = (char *)malloc(strlen(p) + 1); - strcpy(q, p); - bool found = false; - for (int i = 0 ; i < strlen(q); i++) - { - if (q[i] == '/') - { - q[i] = '\\'; - found = true; - } - } - if (found) portable_setenv("PATH",q); - free(q); + QCString result = substitute(p,'/','\\'); + if (result!=p) portable_setenv("PATH",result.data()); #endif } |