]> SALOME platform Git repositories - modules/jobmanager.git/commitdiff
Salome HOME
Default result directory is user home directory BR_WIN_INDUS_514 V5_1_4_BR V5_1_4 V5_1_4_patch01 V5_1_4_patch02 V5_1_4_patch03 V5_1_4rc2 V5_1_4rc3
authorribes <ribes>
Tue, 25 May 2010 12:22:36 +0000 (12:22 +0000)
committerribes <ribes>
Tue, 25 May 2010 12:22:36 +0000 (12:22 +0000)
src/genericgui/BL_CreateJobWizard.cxx

index 97da5a6f3ad78779d18aa2d21358a8f0a5bace06..a5a5b3479dda0e201f69fa3619077e96f5ab74ec 100644 (file)
 
 #include "BL_CreateJobWizard.hxx"
 #include "BL_JobsManager_QT.hxx"
+#include <unistd.h>
+#include <sys/types.h>
+#include <pwd.h>
+#include <stdlib.h>
 
 BL::CreateJobWizard::CreateJobWizard(BL::JobsManager_QT * jobs_manager, BL::SALOMEServices * salome_services)
 {
@@ -676,6 +680,17 @@ BL::FilesPage::FilesPage(BL::CreateJobWizard * parent)
   QPushButton * button_result = new QPushButton("Local Result directory");
   connect(button_result, SIGNAL(clicked()), this, SLOT(choose_local_directory()));
   _result_directory = new QLineEdit(this);
+
+  // Default result directory is home directory (if we found it)
+  // First try -> HOME
+  if (getenv("HOME"))
+    _result_directory->setText(getenv("HOME"));
+  else {
+    // Second try -> getpwuid
+    struct passwd * pass_struct = getpwuid(getuid());
+    if (pass_struct)
+      _result_directory->setText(pass_struct->pw_dir);
+  }
   registerField("result_directory", _result_directory);
 
   QGridLayout * output_box = new QGridLayout;