Mercurial > octave-nkf
comparison gui/src/resource-manager.cc @ 14845:9a355dfc7701 gui
Fixed bug with GUI not starting the first time.
* resource-manager.cc: Now creating config directory before attempting to copy a file to it.
author | Jacob Dawid <jacob.dawid@gmail.com> |
---|---|
date | Sat, 07 Jul 2012 14:28:21 +0200 |
parents | a565c560e654 |
children | d02b229ce693 |
comparison
equal
deleted
inserted
replaced
14833:422b0b2ce5f8 | 14845:9a355dfc7701 |
---|---|
15 * along with this program. If not, see <http://www.gnu.org/licenses/>. | 15 * along with this program. If not, see <http://www.gnu.org/licenses/>. |
16 */ | 16 */ |
17 | 17 |
18 #include "resource-manager.h" | 18 #include "resource-manager.h" |
19 #include <QFile> | 19 #include <QFile> |
20 #include <QDir> | |
21 | |
20 #include <QNetworkProxy> | 22 #include <QNetworkProxy> |
21 | 23 |
22 resource_manager resource_manager::_singleton; | 24 resource_manager resource_manager::_singleton; |
23 | 25 |
24 resource_manager::resource_manager () | 26 resource_manager::resource_manager () |
48 void | 50 void |
49 resource_manager::reload_settings () | 51 resource_manager::reload_settings () |
50 { | 52 { |
51 QDesktopServices desktopServices; | 53 QDesktopServices desktopServices; |
52 _home_path = desktopServices.storageLocation (QDesktopServices::HomeLocation); | 54 _home_path = desktopServices.storageLocation (QDesktopServices::HomeLocation); |
53 QString settings_file = _home_path + "/.config/octave-gui/settings"; | 55 QString settings_path = _home_path + "/.config/octave-gui/"; |
56 QString settings_file = settings_path + "settings"; | |
54 | 57 |
55 if (!QFile::exists (settings_file)) | 58 if (!QFile::exists (settings_file)) |
56 { | 59 { |
60 QDir("/").mkpath (settings_path); | |
57 QFile::copy ("../default-settings", settings_file); | 61 QFile::copy ("../default-settings", settings_file); |
58 _first_run = true; | 62 _first_run = true; |
59 } | 63 } |
60 else | 64 else |
61 _first_run = false; | 65 _first_run = false; |