diff options
author | Dimitri van Heesch <dimitri@stack.nl> | 2015-09-19 14:46:54 (GMT) |
---|---|---|
committer | Dimitri van Heesch <dimitri@stack.nl> | 2015-09-19 14:48:48 (GMT) |
commit | 78a80001223af290c7c7321ad2d210fb3cd16f11 (patch) | |
tree | f55e833dcc06341ea760d44e8a28c022029f5f27 /src/util.cpp | |
parent | 0aa27346b8728f6698dd2b363959e89d02e03ff6 (diff) | |
download | Doxygen-78a80001223af290c7c7321ad2d210fb3cd16f11.zip Doxygen-78a80001223af290c7c7321ad2d210fb3cd16f11.tar.gz Doxygen-78a80001223af290c7c7321ad2d210fb3cd16f11.tar.bz2 |
[Bug 755225] On Windows, generated layout is with UNIX EOL
Diffstat (limited to 'src/util.cpp')
-rwxr-xr-x | src/util.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/util.cpp b/src/util.cpp index e6ea287..3ea10ee 100755 --- a/src/util.cpp +++ b/src/util.cpp @@ -8559,3 +8559,29 @@ void initFilePattern(void) } } } + +bool openOutputFile(const char *outFile,QFile &f) +{ + bool fileOpened=FALSE; + bool writeToStdout=(outFile[0]=='-' && outFile[1]=='\0'); + if (writeToStdout) // write to stdout + { + fileOpened = f.open(IO_WriteOnly,stdout); + } + else // write to file + { + QFileInfo fi(outFile); + if (fi.exists()) // create a backup + { + QDir dir=fi.dir(); + QFileInfo backup(fi.fileName()+".bak"); + if (backup.exists()) // remove existing backup + dir.remove(backup.fileName()); + dir.rename(fi.fileName(),fi.fileName()+".bak"); + } + f.setName(outFile); + fileOpened = f.open(IO_WriteOnly|IO_Translate); + } + return fileOpened; +} + |