On 23.05.2016 02:14 PM, Mike DePaulo wrote:
[...] I've tried 2 different approaches, you can see them below. Ignore the x2goDebug line.
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 925085b..a1d92a8 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10292,6 +10292,8 @@ void ONMainWindow::generateEtcFiles() /* This may need some sanitization, i.e., appDir could potentially include whitespace. */ <<appDir<<"/sftp-server\n"; #endif
- x2goDebug<<"LogLevel DEBUG1";
Force a flush of the current line by appending a newline, like so: out << "LogLevel DEBUG1\n"; Otherwise, the stream might wait for more input to come for the current line (but as it never comes, the line isn't written at all.)
- out<<"LogLevel DEBUG1"; file.close(); x2goDebug<<etcDir +"/sshd_config created."; }
diff --git a/src/onmainwindow.cpp b/src/onmainwindow.cpp index 925085b..928da70 100644 --- a/src/onmainwindow.cpp +++ b/src/onmainwindow.cpp @@ -10293,6 +10293,13 @@ void ONMainWindow::generateEtcFiles() <<appDir<<"/sftp-server\n"; #endif file.close();
This attempt is definitely wrong. The file is being closed here. Afterwards, you cannot write to it anymore. (Or well, you do, but it lands who knows where exactly. Most likely not in the selected file/the file previously associated with the FD.)
- if (debugging)
- {
QTextStream out2 ( &file );
x2goDebug<<"LogLevel DEBUG1";
out2<<"LogLevel DEBUG1";
file.close();
- } x2goDebug<<etcDir +"/sshd_config created."; }
Mihai