MCPcopy Create free account
hub / github.com/DeepRec-AI/DeepRec / GetRunfilesDir

Method GetRunfilesDir

tensorflow/core/platform/posix/env.cc:192–213  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

190 }
191
192 string GetRunfilesDir() override {
193 string bin_path = this->GetExecutablePath();
194 string runfiles_suffix = ".runfiles/org_tensorflow";
195 std::size_t pos = bin_path.find(runfiles_suffix);
196
197 // Sometimes (when executing under python) bin_path returns the full path to
198 // the python scripts under runfiles. Get the substring.
199 if (pos != std::string::npos) {
200 return bin_path.substr(0, pos + runfiles_suffix.length());
201 }
202
203 // See if we have the executable path. if executable.runfiles exists, return
204 // that folder.
205 string runfiles_path = bin_path + runfiles_suffix;
206 Status s = this->IsDirectory(runfiles_path);
207 if (s.ok()) {
208 return runfiles_path;
209 }
210
211 // If nothing can be found, return something close.
212 return bin_path.substr(0, bin_path.find_last_of("/\\"));
213 }
214
215 private:
216 void GetLocalTempDirectories(std::vector<string>* list) override;

Callers

nothing calls this directly

Calls 5

GetExecutablePathMethod · 0.80
findMethod · 0.45
lengthMethod · 0.45
IsDirectoryMethod · 0.45
okMethod · 0.45

Tested by

no test coverage detected