Permalink
Browse files

[Bug 755225] On Windows, generated layout is with UNIX EOL

  • Loading branch information...
Dimitri van Heesch
Dimitri van Heesch committed Sep 19, 2015
1 parent 0aa2734 commit 78a80001223af290c7c7321ad2d210fb3cd16f11
Showing with 30 additions and 26 deletions.
  1. +0 −25 src/doxygen.cpp
  2. +2 −1 src/layout.cpp
  3. +26 −0 src/util.cpp
  4. +2 −0 src/util.h
View
@@ -9097,31 +9097,6 @@ static QCString fixSlashes(QCString &s)
//----------------------------------------------------------------------------
static 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;
}
/*! Generate a template version of the configuration file.
* If the \a shortList parameter is TRUE a configuration file without
* comments will be generated.
View
@@ -1397,7 +1397,8 @@ void LayoutDocManager::parse(QTextStream &t,const char *fileName)
void writeDefaultLayoutFile(const char *fileName)
{
QFile f(fileName);
if (!f.open(IO_WriteOnly))
bool ok = openOutputFile(fileName,f);
if (!ok)
{
err("Failed to open file %s for writing!\n",fileName);
return;
View
@@ -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;
}
View
@@ -57,6 +57,7 @@ class BufStr;
class QFileInfo;
class QStrList;
class FTextStream;
class QFile;
//--------------------------------------------------------------------
@@ -473,6 +474,7 @@ void convertProtectionLevel(
bool mainPageHasTitle();
void initFilePattern(void);
bool openOutputFile(const char *outFile,QFile &f);
#endif

0 comments on commit 78a8000

Please sign in to comment.