MCPcopy Create free account
hub / github.com/computationalpathologygroup/ASAP / changePath

Function changePath

core/filetools.cpp:793–812  ·  view source on GitHub ↗

---------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

791
792//---------------------------------------------------------------------------
793 void changePath(std::string &name, const std::string &newpath)
794 {
795 if (!newpath.empty())
796 {
797 std::string spath = fs::path(newpath).string();
798// if ((!isRoot(spath)) && (extractFileName(name) != ""))
799// spath += dirsep;
800 if (extractFileName(name) != "")
801 name = spath + ((spath[spath.length()-1] == dirsep[0]) ? std::string("") : dirsep) + extractFileName(name);
802 else
803 {
804 name = spath;
805 if (!isRoot(name))
806 name = stripTrailingSlash(spath);
807 }
808 }
809 else
810 // ???? Is this the behaviour we want ?
811 name = extractFileName(name);
812 }
813
814
815//---------------------------------------------------------------------------

Callers 1

mainFunction · 0.85

Calls 4

extractFileNameFunction · 0.85
isRootFunction · 0.85
stripTrailingSlashFunction · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected