diff options
Diffstat (limited to 'lldb/source/Commands/CommandObjectMemory.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectMemory.cpp | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectMemory.cpp b/lldb/source/Commands/CommandObjectMemory.cpp index 95001e08d29..6cec77785d3 100644 --- a/lldb/source/Commands/CommandObjectMemory.cpp +++ b/lldb/source/Commands/CommandObjectMemory.cpp @@ -762,9 +762,9 @@ protected: Stream *output_stream = nullptr; const FileSpec &outfile_spec = m_outfile_options.GetFile().GetCurrentValue(); + + std::string path = outfile_spec.GetPath(); if (outfile_spec) { - char path[PATH_MAX]; - outfile_spec.GetPath(path, sizeof(path)); uint32_t open_options = File::eOpenOptionWrite | File::eOpenOptionCanCreate; @@ -772,19 +772,21 @@ protected: if (append) open_options |= File::eOpenOptionAppend; - if (outfile_stream.GetFile().Open(path, open_options).Success()) { + Status error = FileSystem::Instance().Open(outfile_stream.GetFile(), + outfile_spec, open_options); + if (error.Success()) { if (m_memory_options.m_output_as_binary) { const size_t bytes_written = outfile_stream.Write(data_sp->GetBytes(), bytes_read); if (bytes_written > 0) { result.GetOutputStream().Printf( "%zi bytes %s to '%s'\n", bytes_written, - append ? "appended" : "written", path); + append ? "appended" : "written", path.c_str()); return true; } else { result.AppendErrorWithFormat("Failed to write %" PRIu64 " bytes to '%s'.\n", - (uint64_t)bytes_read, path); + (uint64_t)bytes_read, path.c_str()); result.SetStatus(eReturnStatusFailed); return false; } @@ -794,8 +796,8 @@ protected: output_stream = &outfile_stream; } } else { - result.AppendErrorWithFormat("Failed to open file '%s' for %s.\n", path, - append ? "append" : "write"); + result.AppendErrorWithFormat("Failed to open file '%s' for %s.\n", + path.c_str(), append ? "append" : "write"); result.SetStatus(eReturnStatusFailed); return false; } |