From 6fc396f1809dc63a011ea7f76832489e7ed659e6 Mon Sep 17 00:00:00 2001 From: jfa Date: Fri, 10 Apr 2020 14:38:06 +0300 Subject: [PATCH] bos #18341: HOME environment variable --- src/GUI_PY/selectvars.py | 4 ++-- src/SUIT/SUIT_LicenseDlg.cxx | 7 +++++++ src/SVTK/SVTK_RecorderDlg.cxx | 3 ++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/GUI_PY/selectvars.py b/src/GUI_PY/selectvars.py index ecf0b8e32..cfa8511ed 100644 --- a/src/GUI_PY/selectvars.py +++ b/src/GUI_PY/selectvars.py @@ -126,7 +126,7 @@ class MySelectVarsDialog(Ui_SelectVarsDialog, QDialog): def loadVars(self): filename = QFileDialog.getOpenFileName(self, self.tr("Import variables from file"), - os.getenv("HOME"), + os.path.expanduser("~"), self.tr("XML Files (*.xml)")) if not filename: return @@ -139,7 +139,7 @@ class MySelectVarsDialog(Ui_SelectVarsDialog, QDialog): self.tr("Cannot load file %s:\n%s" % (filename, e))) def saveVars(self): - default = os.path.join(os.getenv("HOME"), "vars.xml") + default = os.path.join(os.path.expanduser("~"), "vars.xml") filename = QFileDialog.getSaveFileName(self, self.tr("Export variables to file"), default, self.tr("XML Files (*.xml)")) if not filename: diff --git a/src/SUIT/SUIT_LicenseDlg.cxx b/src/SUIT/SUIT_LicenseDlg.cxx index bafa48fe8..6989667a1 100644 --- a/src/SUIT/SUIT_LicenseDlg.cxx +++ b/src/SUIT/SUIT_LicenseDlg.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include //#include #include @@ -115,6 +116,7 @@ SUIT_LicenseDlg::~SUIT_LicenseDlg() void SUIT_LicenseDlg::onAgree() { + /* QString env; #ifdef WIN32 DWORD aLen=1024; @@ -138,6 +140,11 @@ void SUIT_LicenseDlg::onAgree() QFile file( env + "/ReadLicense.log" ); // Read the text from a file file.open( QIODevice::WriteOnly ); + */ + QString env = QDir::homePath(); + QFile file( env + "/ReadLicense.log" ); + if (!file.open( QIODevice::WriteOnly )) + reject(); QTextStream ts( &file ); ts << "OK" << endl; diff --git a/src/SVTK/SVTK_RecorderDlg.cxx b/src/SVTK/SVTK_RecorderDlg.cxx index 07cc78f7a..be14adc76 100644 --- a/src/SVTK/SVTK_RecorderDlg.cxx +++ b/src/SVTK/SVTK_RecorderDlg.cxx @@ -38,6 +38,7 @@ #include #include #include +#include /*! * Constructor @@ -175,7 +176,7 @@ bool SVTK_RecorderDlg::onBrowseFile() aFilter.append( tr( "FLT_AVI_FILES" ) ); aFilter.append( tr( "FLT_ALL_FILES" ) ); - QString aFileName = SUIT_FileDlg::getFileName( this, Qtx::getenv( "HOME" ), aFilter, + QString aFileName = SUIT_FileDlg::getFileName( this, QDir::homePath(), aFilter, tr( "FILE_NAME" ), false ); if( aFileName.isNull() ) -- 2.39.2