MCPcopy Create free account
hub / github.com/ZDoom/Raze / NormalizeFileName

Function NormalizeFileName

source/common/utility/cmdlib.cpp:966–991  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

964//==========================================================================
965
966void NormalizeFileName(FString& str)
967{
968 FixPathSeperator(str);
969 auto splits = str.Split("/");
970 for (unsigned i = 1; i < splits.Size(); i++)
971 {
972 if (splits[i].Compare(".") == 0)
973 {
974 splits.Delete(i);
975 i--;
976 }
977
978 if (splits[i].Compare("..") == 0 && splits[i - 1].Compare("..") != 0)
979 {
980 splits.Delete(i);
981 splits.Delete(i - 1);
982 i -= 2;
983 if (i < 1) i = 1;
984 }
985 }
986 str = splits[0];
987 for (unsigned i = 1; i < splits.Size(); i++)
988 {
989 str << "/" << splits[i];
990 }
991}
992
993//==========================================================================
994//

Callers 4

CheckUserMapFunction · 0.85
AddDirectoryMethod · 0.85
OpenMethod · 0.85
OpenMethod · 0.85

Calls 5

SplitMethod · 0.80
FixPathSeperatorFunction · 0.70
SizeMethod · 0.45
CompareMethod · 0.45
DeleteMethod · 0.45

Tested by

no test coverage detected