feat: app.getPath('recent') (#23381)
* feat: getPath("recent") * test: Add a spec and docs * fix: Integrate feedback * fix: Handle path change * chore: Cut SetRecentPath
This commit is contained in:
parent
c7b2eb68cf
commit
dcbed18f44
6 changed files with 57 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
|||
#include "base/win/windows_version.h"
|
||||
#include "content/public/browser/browser_task_traits.h"
|
||||
#include "content/public/browser/browser_thread.h"
|
||||
#include "shell/common/electron_paths.h"
|
||||
#include "ui/base/win/shell.h"
|
||||
#include "url/gurl.h"
|
||||
|
||||
|
@ -392,6 +393,22 @@ bool MoveItemToTrash(const base::FilePath& path, bool delete_on_fail) {
|
|||
SUCCEEDED(pfo->PerformOperations());
|
||||
}
|
||||
|
||||
bool GetFolderPath(int key, base::FilePath* result) {
|
||||
wchar_t system_buffer[MAX_PATH];
|
||||
|
||||
switch (key) {
|
||||
case electron::DIR_RECENT:
|
||||
if (FAILED(SHGetFolderPath(NULL, CSIDL_RECENT, NULL, SHGFP_TYPE_CURRENT,
|
||||
system_buffer))) {
|
||||
return false;
|
||||
}
|
||||
*result = base::FilePath(system_buffer);
|
||||
break;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Beep() {
|
||||
MessageBeep(MB_OK);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue