Skip to content

Commit

Permalink
Adds -rf for removal of files from device after retrieval
Browse files Browse the repository at this point in the history
  • Loading branch information
GrantComm committed Dec 9, 2024
1 parent 8b540a1 commit 4e6bf13
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 15 deletions.
9 changes: 2 additions & 7 deletions capture_service/device_mgr.cc
Original file line number Diff line number Diff line change
Expand Up @@ -422,15 +422,10 @@ absl::Status DeviceManager::Cleanup(const std::string &serial, const std::string
}

absl::Status AndroidDevice::RetrieveTrace(const std::string &trace_path,
const std::string &save_path,
const bool isGfxrCapture)
const std::string &save_path)
{
RETURN_IF_ERROR(Adb().Run(absl::StrFormat("pull %s %s", trace_path, save_path)));
if (isGfxrCapture)
{
return Adb().Run(absl::StrFormat("shell rm -rf %s", trace_path));
}
return Adb().Run(absl::StrFormat("shell rm %s", trace_path));
return Adb().Run(absl::StrFormat("shell rm -rf %s", trace_path));
}

void AndroidDevice::EnableGfxr(bool enable_gfxr)
Expand Down
4 changes: 1 addition & 3 deletions capture_service/device_mgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,7 @@ class AndroidDevice
AdbSession &Adb() { return m_adb; }

AndroidApplication *GetCurrentApplication() { return m_app.get(); }
absl::Status RetrieveTrace(const std::string &trace_file_path,
const std::string &save_path,
const bool is_gfxr_capture);
absl::Status RetrieveTrace(const std::string &trace_file_path, const std::string &save_path);

private:
const std::string m_serial;
Expand Down
6 changes: 2 additions & 4 deletions capture_service/dive_client_cli.cc
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ bool trigger_capture(Dive::DeviceManager& mgr)
}
target_download_path /= p.filename();
auto ret = mgr.GetDevice()->RetrieveTrace(*trace_file_path,
target_download_path.generic_string(),
false);
target_download_path.generic_string());
if (ret.ok())
std::cout << "Capture saved at " << target_download_path << std::endl;
else
Expand All @@ -339,8 +338,7 @@ bool retrieve_gfxr_capture(Dive::DeviceManager& mgr, const std::string& gfxr_cap
}
std::string capture_directory = Dive::kGfxrCaptureDirectory + gfxr_capture_directory;
auto ret = mgr.GetDevice()->RetrieveTrace(capture_directory,
target_download_path.generic_string(),
true);
target_download_path.generic_string());
if (ret.ok())
std::cout << "GFXR capture directory saved at " << target_download_path << std::endl;
else
Expand Down
2 changes: 1 addition & 1 deletion ui/trace_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -563,7 +563,7 @@ void TraceWorker::run()

std::chrono::steady_clock::time_point begin = std::chrono::steady_clock::now();
qDebug() << "Begin to download the trace file to " << target.generic_string().c_str();
auto r = device->RetrieveTrace(*trace_file_path, target.generic_string(), false);
auto r = device->RetrieveTrace(*trace_file_path, target.generic_string());
progress_bar_worker->terminate();
m_progress_bar->setValue(100);
if (r.ok())
Expand Down

0 comments on commit 4e6bf13

Please sign in to comment.