From 431b71bebc374531378ca9bcd2000652e04e8385 Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Mon, 8 Sep 2014 20:52:38 +0300 Subject: [PATCH 1/2] Fixed the CSV bug --- src/jceData/CSV/csv_exporter.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/src/jceData/CSV/csv_exporter.cpp b/src/jceData/CSV/csv_exporter.cpp index 249548d..852543f 100644 --- a/src/jceData/CSV/csv_exporter.cpp +++ b/src/jceData/CSV/csv_exporter.cpp @@ -40,13 +40,18 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched) QString room = QString(coursePtr->getRoom().c_str()); QString line = makeLine(name, day, startH, startM, endH, endM, lecturer, room, type); +#ifdef Q_OS_LINUX || Q_OS_UNIX if(line != NULL) - { - #ifndef Q_OS_WIN32 - out << line << char(0x0D) << " "; //Fucking M$ Special end line shit... - #endif out << line << char(0x0A); - } +#endif +#ifdef Q_OS_OSX + if(line != NULL) + out << line << char(0x0A); +#endif +#ifdef Q_OS_WIN + if(line != NULL) + out << line << char(0x0D); +#endif } From df791d62b4538fd338301083be1a2f6cc974e23f Mon Sep 17 00:00:00 2001 From: Sagi Dayan Date: Mon, 8 Sep 2014 20:59:02 +0300 Subject: [PATCH 2/2] Need testing on mac and Windows --- src/jceData/CSV/csv_exporter.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/jceData/CSV/csv_exporter.cpp b/src/jceData/CSV/csv_exporter.cpp index 852543f..7b942e6 100644 --- a/src/jceData/CSV/csv_exporter.cpp +++ b/src/jceData/CSV/csv_exporter.cpp @@ -18,12 +18,12 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched) qDebug() << "Atempting to export the Schedule..."; QFile file(filePath); - if(!file.open(QIODevice::ReadWrite | QIODevice::Text)) + if(!file.open(QIODevice::ReadWrite | QIODevice::Text |QIODevice::Truncate)) { qDebug() << "unable to open/create the file... maybe permissions error."; return false; }//else - + //Delete the file QTextStream out(&file); out << CSV_CALENDAR_HEADER << "\n"; for (calendarCourse *coursePtr: *(calSched->getCourses())) @@ -50,7 +50,7 @@ bool CSV_Exporter::exportCalendar(calendarSchedule *calSched) #endif #ifdef Q_OS_WIN if(line != NULL) - out << line << char(0x0D); + out << line << char(0x0D) << char(0x0A); #endif }