Solving issue 2046: "RT crash on First run"
This commit is contained in:
@@ -340,6 +340,7 @@ void DirBrowser::open (const Glib::ustring& dirname, const Glib::ustring& fileNa
|
||||
|
||||
dirtree->collapse_all ();
|
||||
|
||||
// WARNING & TODO: One should test here if the directory/file has R/W access permission to avoid crash
|
||||
|
||||
Glib::RefPtr<Gio::File> dir = Gio::File::create_for_path(dirname);
|
||||
if( !dir->query_exists())
|
||||
@@ -348,8 +349,12 @@ void DirBrowser::open (const Glib::ustring& dirname, const Glib::ustring& fileNa
|
||||
Gtk::TreePath path = expandToDir (absDirPath);
|
||||
dirtree->scroll_to_row (path);
|
||||
dirtree->get_selection()->select (path);
|
||||
for (size_t i=0; i<dllisteners.size(); i++)
|
||||
dllisteners[i]->dirSelected (absDirPath, Glib::build_filename (absDirPath, fileName));
|
||||
Glib::ustring absFilePath;
|
||||
if (!fileName.empty())
|
||||
absFilePath = Glib::build_filename (absDirPath, fileName);
|
||||
for (size_t i=0; i<dllisteners.size(); i++) {
|
||||
dllisteners[i]->dirSelected (absDirPath, absFilePath);
|
||||
}
|
||||
}
|
||||
|
||||
void DirBrowser::file_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, const Gtk::TreeModel::iterator& iter, const Glib::ustring& dirName) {
|
||||
|
@@ -144,7 +144,7 @@ void FilePanel::init () {
|
||||
dirBrowser->open (argv1);
|
||||
else {
|
||||
if (options.startupDir==STARTUPDIR_HOME)
|
||||
dirBrowser->open (Glib::get_home_dir());
|
||||
dirBrowser->open (safe_get_user_picture_dir());
|
||||
else if (options.startupDir==STARTUPDIR_CURRENT)
|
||||
dirBrowser->open (argv0);
|
||||
else if (options.startupDir==STARTUPDIR_CUSTOM || options.startupDir==STARTUPDIR_LAST) {
|
||||
@@ -152,7 +152,7 @@ void FilePanel::init () {
|
||||
dirBrowser->open (options.startupPath);
|
||||
else {
|
||||
// Fallback option if the path is empty or the folder doesn't exist
|
||||
dirBrowser->open (Glib::get_home_dir());
|
||||
dirBrowser->open (safe_get_user_picture_dir());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -87,7 +87,7 @@ void PlacesBrowser::refreshPlacesList () {
|
||||
placesModel->clear ();
|
||||
|
||||
// append home directory
|
||||
Glib::RefPtr<Gio::File> hfile = Gio::File::create_for_path (Glib::get_home_dir ());
|
||||
Glib::RefPtr<Gio::File> hfile = Gio::File::create_for_path (safe_get_user_home_dir()); // Will send back "My documents" on Windows now, which has no restricted access
|
||||
if (hfile && hfile->query_exists()) {
|
||||
try {
|
||||
Glib::RefPtr<Gio::FileInfo> info = safe_query_file_info (hfile);
|
||||
|
Reference in New Issue
Block a user