[GPU] Accept input and output path as command line parameters

This commit is contained in:
DrChat 2017-12-15 23:48:23 -06:00
parent 3d1a1c2519
commit bf9fa02b18
1 changed files with 14 additions and 5 deletions

View File

@ -43,6 +43,7 @@ TraceDump::~TraceDump() = default;
int TraceDump::Main(const std::vector<std::wstring>& args) { int TraceDump::Main(const std::vector<std::wstring>& args) {
// Grab path from the flag or unnamed argument. // Grab path from the flag or unnamed argument.
std::wstring path; std::wstring path;
std::wstring output_path;
if (!FLAGS_target_trace_file.empty()) { if (!FLAGS_target_trace_file.empty()) {
// Passed as a named argument. // Passed as a named argument.
// TODO(benvanik): find something better than gflags that supports // TODO(benvanik): find something better than gflags that supports
@ -51,6 +52,10 @@ int TraceDump::Main(const std::vector<std::wstring>& args) {
} else if (args.size() >= 2) { } else if (args.size() >= 2) {
// Passed as an unnamed argument. // Passed as an unnamed argument.
path = args[1]; path = args[1];
if (args.size() >= 3) {
output_path = args[2];
}
} else { } else {
// Open a file chooser and ask the user. // Open a file chooser and ask the user.
auto file_picker = xe::ui::FilePicker::Create(); auto file_picker = xe::ui::FilePicker::Create();
@ -89,11 +94,15 @@ int TraceDump::Main(const std::vector<std::wstring>& args) {
} }
// Root file name for outputs. // Root file name for outputs.
base_output_path_ = if (output_path.empty()) {
xe::fix_path_separators(xe::to_wstring(FLAGS_trace_dump_path)); base_output_path_ =
base_output_path_ = xe::fix_path_separators(xe::to_wstring(FLAGS_trace_dump_path));
xe::join_paths(base_output_path_, base_output_path_ =
xe::find_name_from_path(xe::fix_path_separators(path))); xe::join_paths(base_output_path_,
xe::find_name_from_path(xe::fix_path_separators(path)));
} else {
base_output_path_ = xe::fix_path_separators(output_path);
}
// Ensure output path exists. // Ensure output path exists.
xe::filesystem::CreateParentFolder(base_output_path_); xe::filesystem::CreateParentFolder(base_output_path_);