mirror of
https://github.com/saitohirga/WSJT-X.git
synced 2026-06-13 19:29:02 -04:00
Make temp directory unique in test mode.
The Qt test mode that uses special paths for writeable files (via QtStandardPaths) doesn't make a special temporary file path. This change appends " - test_mode" to the WSJT-X unique temporary file path so that an application run in test mode will not interact with another running in normal mode. git-svn-id: svn+ssh://svn.code.sf.net/p/wsjt/wsjt/branches/wsjtx@4240 ab8295b8-cf94-4d9e-aec4-7959e3be5d79
This commit is contained in:
+8
-4
@@ -207,7 +207,7 @@ class Configuration::impl final
|
||||
public:
|
||||
using FrequencyDelta = Radio::FrequencyDelta;
|
||||
|
||||
explicit impl (Configuration * self, QString const& instance_key, QSettings * settings, QWidget * parent);
|
||||
explicit impl (Configuration * self, QString const& instance_key, QSettings * settings, bool test_mode, QWidget * parent);
|
||||
~impl ();
|
||||
|
||||
bool have_rig (bool open_if_closed = true);
|
||||
@@ -398,8 +398,8 @@ private:
|
||||
|
||||
|
||||
// delegate to implementation class
|
||||
Configuration::Configuration (QString const& instance_key, QSettings * settings, QWidget * parent)
|
||||
: m_ {this, instance_key, settings, parent}
|
||||
Configuration::Configuration (QString const& instance_key, QSettings * settings, bool test_mode, QWidget * parent)
|
||||
: m_ {this, instance_key, settings, test_mode, parent}
|
||||
{
|
||||
}
|
||||
|
||||
@@ -517,7 +517,7 @@ void Configuration::sync_transceiver (bool force_signal, bool enforce_mode_and_s
|
||||
}
|
||||
|
||||
|
||||
Configuration::impl::impl (Configuration * self, QString const& instance_key, QSettings * settings, QWidget * parent)
|
||||
Configuration::impl::impl (Configuration * self, QString const& instance_key, QSettings * settings, bool test_mode, QWidget * parent)
|
||||
: QDialog {parent}
|
||||
, self_ {self}
|
||||
, ui_ {new Ui::configuration_dialog}
|
||||
@@ -576,6 +576,10 @@ Configuration::impl::impl (Configuration * self, QString const& instance_key, QS
|
||||
}
|
||||
|
||||
QString unique_directory {instance_key};
|
||||
if (test_mode)
|
||||
{
|
||||
unique_directory += " - test_mode";
|
||||
}
|
||||
if (!temp_path_.mkpath (unique_directory) || !temp_path_.cd (unique_directory))
|
||||
{
|
||||
QMessageBox::critical (this, "WSJT-X", tr ("Create temporary directory error: ") + temp_path_.absolutePath ());
|
||||
|
||||
Reference in New Issue
Block a user