get_desktop_directory.cc 745 B

12345678910111213141516171819202122
  1. // Copyright 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "remoting/host/file_transfer/get_desktop_directory.h"
  5. #include "base/logging.h"
  6. #include "base/path_service.h"
  7. namespace remoting {
  8. protocol::FileTransferResult<base::FilePath> GetDesktopDirectory() {
  9. base::FilePath target_directory;
  10. if (!base::PathService::Get(base::DIR_USER_DESKTOP, &target_directory)) {
  11. LOG(ERROR) << "Failed to get DIR_USER_DESKTOP from base::PathService::Get";
  12. return protocol::MakeFileTransferError(
  13. FROM_HERE, protocol::FileTransfer_Error_Type_UNEXPECTED_ERROR);
  14. }
  15. return target_directory;
  16. }
  17. } // namespace remoting