From ce5b6531ec75ee8b6f86d0395b8290f27a61b400 Mon Sep 17 00:00:00 2001 From: ribes Date: Tue, 25 May 2010 12:22:36 +0000 Subject: [PATCH] Default result directory is user home directory --- src/genericgui/BL_CreateJobWizard.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/genericgui/BL_CreateJobWizard.cxx b/src/genericgui/BL_CreateJobWizard.cxx index 97da5a6..a5a5b34 100644 --- a/src/genericgui/BL_CreateJobWizard.cxx +++ b/src/genericgui/BL_CreateJobWizard.cxx @@ -19,6 +19,10 @@ #include "BL_CreateJobWizard.hxx" #include "BL_JobsManager_QT.hxx" +#include +#include +#include +#include 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; -- 2.39.2