OmarEmaraDev created this revision. OmarEmaraDev added a reviewer: clayborg. Herald added a reviewer: teemperor. OmarEmaraDev requested review of this revision. Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
This patch resolves the paths in the file/directory fields before performing checks. Those checks are applied on the file system if m_need_to_exist is true, so remote files can set this to false to avoid performing host-side file system checks. Additionally, methods to get a resolved and a direct file specs were added to be used by client code. Repository: rG LLVM Github Monorepo https://reviews.llvm.org/D106553 Files: lldb/source/Core/IOHandlerCursesGUI.cpp Index: lldb/source/Core/IOHandlerCursesGUI.cpp =================================================================== --- lldb/source/Core/IOHandlerCursesGUI.cpp +++ lldb/source/Core/IOHandlerCursesGUI.cpp @@ -1297,8 +1297,11 @@ if (!IsSpecified()) return; - FileSpec file(GetPath()); - if (m_need_to_exist && !FileSystem::Instance().Exists(file)) { + if (!m_need_to_exist) + return; + + FileSpec file = GetResolvedFileSpec(); + if (!FileSystem::Instance().Exists(file)) { SetError("File doesn't exist!"); return; } @@ -1308,7 +1311,17 @@ } } - // Returns the path of the file. + FileSpec GetFileSpec() { + FileSpec file_spec(GetPath()); + return file_spec; + } + + FileSpec GetResolvedFileSpec() { + FileSpec file_spec(GetPath()); + FileSystem::Instance().Resolve(file_spec); + return file_spec; + } + const std::string &GetPath() { return m_content; } protected: @@ -1327,8 +1340,11 @@ if (!IsSpecified()) return; - FileSpec file(GetPath()); - if (m_need_to_exist && !FileSystem::Instance().Exists(file)) { + if (!m_need_to_exist) + return; + + FileSpec file = GetResolvedFileSpec(); + if (!FileSystem::Instance().Exists(file)) { SetError("Directory doesn't exist!"); return; } @@ -1338,7 +1354,17 @@ } } - // Returns the path of the file. + FileSpec GetFileSpec() { + FileSpec file_spec(GetPath()); + return file_spec; + } + + FileSpec GetResolvedFileSpec() { + FileSpec file_spec(GetPath()); + FileSystem::Instance().Resolve(file_spec); + return file_spec; + } + const std::string &GetPath() { return m_content; } protected:
Index: lldb/source/Core/IOHandlerCursesGUI.cpp =================================================================== --- lldb/source/Core/IOHandlerCursesGUI.cpp +++ lldb/source/Core/IOHandlerCursesGUI.cpp @@ -1297,8 +1297,11 @@ if (!IsSpecified()) return; - FileSpec file(GetPath()); - if (m_need_to_exist && !FileSystem::Instance().Exists(file)) { + if (!m_need_to_exist) + return; + + FileSpec file = GetResolvedFileSpec(); + if (!FileSystem::Instance().Exists(file)) { SetError("File doesn't exist!"); return; } @@ -1308,7 +1311,17 @@ } } - // Returns the path of the file. + FileSpec GetFileSpec() { + FileSpec file_spec(GetPath()); + return file_spec; + } + + FileSpec GetResolvedFileSpec() { + FileSpec file_spec(GetPath()); + FileSystem::Instance().Resolve(file_spec); + return file_spec; + } + const std::string &GetPath() { return m_content; } protected: @@ -1327,8 +1340,11 @@ if (!IsSpecified()) return; - FileSpec file(GetPath()); - if (m_need_to_exist && !FileSystem::Instance().Exists(file)) { + if (!m_need_to_exist) + return; + + FileSpec file = GetResolvedFileSpec(); + if (!FileSystem::Instance().Exists(file)) { SetError("Directory doesn't exist!"); return; } @@ -1338,7 +1354,17 @@ } } - // Returns the path of the file. + FileSpec GetFileSpec() { + FileSpec file_spec(GetPath()); + return file_spec; + } + + FileSpec GetResolvedFileSpec() { + FileSpec file_spec(GetPath()); + FileSystem::Instance().Resolve(file_spec); + return file_spec; + } + const std::string &GetPath() { return m_content; } protected:
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits