MCPcopy Create free account
hub / github.com/amwatson/CitraVR / SplitPath

Function SplitPath

src/common/string_util.cpp:73–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73bool SplitPath(const std::string& full_path, std::string* _pPath, std::string* _pFilename,
74 std::string* _pExtension) {
75 if (full_path.empty())
76 return false;
77
78 std::size_t dir_end = full_path.find_last_of("/"
79// windows needs the : included for something like just "C:" to be considered a directory
80#ifdef _WIN32
81 ":"
82#endif
83 );
84 if (std::string::npos == dir_end)
85 dir_end = 0;
86 else
87 dir_end += 1;
88
89 std::size_t fname_end = full_path.rfind('.');
90 if (fname_end < dir_end || std::string::npos == fname_end)
91 fname_end = full_path.size();
92
93 if (_pPath)
94 *_pPath = full_path.substr(0, dir_end);
95
96 if (_pFilename)
97 *_pFilename = full_path.substr(dir_end, fname_end - dir_end);
98
99 if (_pExtension)
100 *_pExtension = full_path.substr(fname_end);
101
102 return true;
103}
104
105void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _Path,
106 const std::string& _Filename) {

Callers 5

dataMethod · 0.85
dataMethod · 0.85
WriteTitleMetadataMethod · 0.85
GetTitleMetadataPathFunction · 0.85
GetLoaderFunction · 0.85

Calls 2

emptyMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected