Remove trailing spaces and dots in file name and in dir names in path.
| 987 | |
| 988 | // Remove trailing spaces and dots in file name and in dir names in path. |
| 989 | void MakeNameCompatible(wchar *Name) |
| 990 | { |
| 991 | int Src=0,Dest=0; |
| 992 | while (true) |
| 993 | { |
| 994 | if (IsPathDiv(Name[Src]) || Name[Src]==0) |
| 995 | for (int I=Dest-1;I>0 && (Name[I]==' ' || Name[I]=='.');I--) |
| 996 | { |
| 997 | // Permit path1/./path2 and ../path1 paths. |
| 998 | if (Name[I]=='.' && (IsPathDiv(Name[I-1]) || Name[I-1]=='.' && I==1)) |
| 999 | break; |
| 1000 | Dest--; |
| 1001 | } |
| 1002 | Name[Dest]=Name[Src]; |
| 1003 | if (Name[Src]==0) |
| 1004 | break; |
| 1005 | Src++; |
| 1006 | Dest++; |
| 1007 | } |
| 1008 | } |
| 1009 | #endif |
no test coverage detected