MCPcopy Create free account
hub / github.com/NPP-JSONViewer/JSON-Viewer / GetFileName

Method GetFileName

src/UtilityLib/Utility.cpp:153–170  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

151}
152
153auto CUtility::GetFileName(const std::wstring& fullPath, bool withExtension) -> std::wstring
154{
155 std::filesystem::path pathObj(fullPath);
156
157 // Check if file name is required without extension
158 if (withExtension == false)
159 {
160 // Check if file has stem i.e. filename without extension
161 if (pathObj.has_stem())
162 {
163 // return the stem (file name without extension) from path object
164 return pathObj.stem().wstring();
165 }
166 }
167
168 // return the file name with extension from path object
169 return pathObj.filename().wstring();
170}
171
172auto CUtility::GetFileExtension(const std::wstring& fileName) -> std::wstring
173{

Callers 1

TESTFunction · 0.80

Calls

no outgoing calls

Tested by 1

TESTFunction · 0.64