Ticket #9572: 0001-Automatically-detect-default-download-folder.patch

File 0001-Automatically-detect-default-download-folder.patch, 1.5 KB (added by Francois Ferrand, 10 years ago)
  • src/interface/context_control.cpp

    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  
    11#include <filezilla.h>
     2#include <wx/stdpaths.h>
    23#include "commandqueue.h"
    34#include "context_control.h"
    45#include "filelist_statusbar.h"
    void CContextControl::CreateTab()  
    9091
    9192    pState->GetRecursiveOperationHandler()->SetQueue(m_pMainFrame->GetQueue());
    9293
    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;
    96107
    97108    CContextManager::Get()->SetCurrentContext(pState);
    98109