serial_port_plotter icon indicating copy to clipboard operation
serial_port_plotter copied to clipboard

Exports CSV + PNG not work on Mac OS 10.13.6

Open turbyho opened this issue 6 years ago • 9 comments

turbyho avatar Nov 13 '18 21:11 turbyho

Hello, I'm on linux debian stretch actually. If I run this app from Qtcreator, the different exports work as well. It's save my files in hte home directory. But if I compile it and install it with qmake && make install, no exports work...

I'm trying to find the problem.

netbomo avatar Nov 19 '19 15:11 netbomo

Is there anything appearing in the system logs (e.g. permission denied)?

On Tue, Nov 19, 2019, 11:07 PM gilou [email protected] wrote:

Hello, I'm on linux debian stretch actually. If I run this app from Qtcreator, the different exports work as well. It's save my files in hte home directory. But if I compile it and install it with qmake && make install, no exports work...

I'm trying to find the problem.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/CieNTi/serial_port_plotter/issues/9?email_source=notifications&email_token=AA7MKN7RGNYY2V6AYWOJRL3QUP6JPA5CNFSM4GDSBGJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEOQGNA#issuecomment-555549492, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7MKNYQPAND7FYPOUSTZSLQUP6JPANCNFSM4GDSBGJQ .

lwchkg avatar Nov 19 '19 15:11 lwchkg

hello, add QDir::homePath() + '/' +
in the mainwindow.cpp file at line 817 :

convert 
m_csvFile = new QFile(QDateTime::currentDateTime().toString("yyyy-MM-d-HH-mm-ss-")+"data-out.csv");
in
m_csvFile = new QFile(QDir::homePath() + '/' + QDateTime::currentDateTime().toString("yyyy-MM-d-HH-mm-ss-")+"data-out.csv");

and at line 553

convert
ui->plot->savePng (QString::number(dataPointNumber) + ".png", 1920, 1080, 2, 50);
in
ui->plot->savePng (QDir::homePath() + '/' + QString::number(dataPointNumber) + ".png", 1920, 1080, 2, 50);

That do the trick but after a stop/play png export is disable...

netbomo avatar Nov 19 '19 15:11 netbomo

That it's because in the two lines, only the filename is setted but not the path for the file, on unix system it's trying to write in the /usr/bin folder but it's root access. So it's a better practice to use the environment variable gived by QDir::homePath() before the file name. By the way, using the / character after QDir::homePath() is not a good option in order to be ported on windows...

netbomo avatar Nov 19 '19 15:11 netbomo

Is there any function that perform the path operation correctly cross-platform?

On Tue, Nov 19, 2019, 11:57 PM gilou [email protected] wrote:

That it's because in the two lines, only the filename is setted but not the path for the file, on unix system it's trying to write in the /usr/bin folder but it's root access. So it's a better practice to use the environment variable gived by QDir::homePath() before the file name. By the way, using the / character after QDir::homePath() is not a good option in order to be ported on windows...

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/CieNTi/serial_port_plotter/issues/9?email_source=notifications&email_token=AA7MKN6MV4Z3KTCPVFCHZVTQUQEGFA5CNFSM4GDSBGJ2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEEOV6JY#issuecomment-555573031, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA7MKN2M2JQUQTHYNWAPJADQUQEGFANCNFSM4GDSBGJQ .

lwchkg avatar Nov 19 '19 16:11 lwchkg

As writted in the Qt documentation, Qt replace the / by \ when is compliling for windows.

See : https://doc.qt.io/qt-5/qdir.html#Separator

netbomo avatar Nov 19 '19 16:11 netbomo

@netbomo If you want to make a pull request I can update the repo with your fixes. Thanks for the feedback

CieNTi avatar Nov 20 '19 10:11 CieNTi

I will do that next week, l've update some small things and prepare the repo in order to be compiled on linux debian distro.

netbomo avatar Nov 20 '19 11:11 netbomo

Nice, as is the one I'm using so I'll be able to also test your request with not big delay :D

CieNTi avatar Nov 20 '19 11:11 CieNTi