You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by wu...@apache.org on 2022/08/01 17:16:37 UTC

[tvm] branch main updated: [CPP-RPC] Fix GetPath to use relative file path (#12242)

This is an automated email from the ASF dual-hosted git repository.

wuwei pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/tvm.git


The following commit(s) were added to refs/heads/main by this push:
     new d2d3010dc6 [CPP-RPC] Fix GetPath to use relative file path (#12242)
d2d3010dc6 is described below

commit d2d3010dc6e1236e9b37ff91fcc591c7396498f1
Author: yoyo-nb <48...@users.noreply.github.com>
AuthorDate: Tue Aug 2 01:16:29 2022 +0800

    [CPP-RPC] Fix GetPath to use relative file path (#12242)
    
    * [CPP-RPC] Fix GetPath to use relative file path
    
    * change file_path to file_name
---
 apps/cpp_rpc/rpc_env.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/apps/cpp_rpc/rpc_env.cc b/apps/cpp_rpc/rpc_env.cc
index be172cea4e..fc19dd87b8 100644
--- a/apps/cpp_rpc/rpc_env.cc
+++ b/apps/cpp_rpc/rpc_env.cc
@@ -157,9 +157,9 @@ RPCEnv::RPCEnv(const std::string& wd) {
  * \return The full path of file.
  */
 std::string RPCEnv::GetPath(const std::string& file_name) const {
-  // we assume file_name has "/" means file_name is the exact path
+  // we assume file_name starts with "/" means file_name is the exact path
   // and does not create /.rpc/
-  return file_name.find('/') != std::string::npos ? file_name : base_ + "/" + file_name;
+  return !file_name.empty() && file_name[0] == '/' ? file_name : base_ + "/" + file_name;
 }
 /*!
  * \brief Remove The RPC Environment cleanup function