Skip to content
This repository has been archived by the owner on Jan 4, 2019. It is now read-only.

Set initial default download path #390

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions atom/browser/api/atom_api_app.cc
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
#include "brave/common/workers/v8_worker_thread.h"
#include "brave/common/workers/worker_bindings.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_paths_internal.h"
#include "components/component_updater/component_updater_paths.h"
#include "content/browser/plugin_service_impl.h"
#include "content/child/worker_thread_registry.h"
Expand Down Expand Up @@ -699,6 +700,12 @@ void App::SetPath(mate::Arguments* args,
args->ThrowError("Failed to set path");
}

base::FilePath App::GetInitialDownloadPath() {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this already accessible with getPath('downloads')?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, you are right!!! I'm going to close this PR and update PR of browser-laptop

base::FilePath path;
chrome::GetUserDownloadsDirectory(&path);
return path;
}

void App::SetDesktopName(const std::string& desktop_name) {
#if defined(OS_LINUX)
std::unique_ptr<base::Environment> env(base::Environment::Create());
Expand Down Expand Up @@ -948,6 +955,7 @@ void App::BuildPrototype(
#endif
.SetMethod("setPath", &App::SetPath)
.SetMethod("getPath", &App::GetPath)
.SetMethod("getInitialDownloadPath", &App::GetInitialDownloadPath)
.SetMethod("setDesktopName", &App::SetDesktopName)
.SetMethod("getLocale", &App::GetLocale)
.SetMethod("setLocale", &App::SetLocale)
Expand Down
2 changes: 2 additions & 0 deletions atom/browser/api/atom_api_app.h
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ class App : public AtomBrowserClient::Delegate,
const std::string& name,
const base::FilePath& path);

base::FilePath GetInitialDownloadPath();

void SetDesktopName(const std::string& desktop_name);
void SetLocale(std::string);
std::string GetLocale();
Expand Down