From 2bc4d2a1a50fb5264d03dc5d862e6548b837c685 Mon Sep 17 00:00:00 2001
From: Francois Ferrand <thetypz@gmail.com>
Date: Mon, 24 Feb 2014 19:07:14 +0100
Subject: [PATCH] Automatically detect default download folder.
---
src/interface/context_control.cpp | 17 ++++++++++++++---
1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/src/interface/context_control.cpp b/src/interface/context_control.cpp
index c825a66..e91b0f9 100644
a
|
b
|
|
1 | 1 | #include <filezilla.h> |
| 2 | #include <wx/stdpaths.h> |
2 | 3 | #include "commandqueue.h" |
3 | 4 | #include "context_control.h" |
4 | 5 | #include "filelist_statusbar.h" |
… |
… |
void CContextControl::CreateTab()
|
90 | 91 | |
91 | 92 | pState->GetRecursiveOperationHandler()->SetQueue(m_pMainFrame->GetQueue()); |
92 | 93 | |
93 | | wxString localDir = COptions::Get()->GetOption(OPTION_LASTLOCALDIR); |
94 | | if (!pState->SetLocalDir(localDir)) |
95 | | pState->SetLocalDir(_T("/")); |
| 94 | const wxString paths[] = { |
| 95 | COptions::Get()->GetOption(OPTION_LASTLOCALDIR), |
| 96 | #ifdef __WXOSX__ |
| 97 | wxStandardPaths::Get().GetDocumentsDir() + _T("/../Downloads"), |
| 98 | #endif |
| 99 | wxStandardPaths::Get().GetDocumentsDir() + _T("/Download"), |
| 100 | wxStandardPaths::Get().GetDocumentsDir() + _T("/Downloads"), |
| 101 | wxStandardPaths::Get().GetDocumentsDir(), |
| 102 | _T("/") |
| 103 | }; |
| 104 | for(size_t i=0; i<sizeof(paths)/sizeof(paths[0]); i++) |
| 105 | if (pState->SetLocalDir(paths[i])) |
| 106 | break; |
96 | 107 | |
97 | 108 | CContextManager::Get()->SetCurrentContext(pState); |
98 | 109 | |