We deal with paths all the time, and I hate to check for the last backslash before appending a filename to the path. I made this function to check for the backslash and either add one or remove it. Usage:FileAndPathStr := BackSlash(SomeDirectory, _ADD) + 'TheFile.tmp'; type BackSlashAction = (_ADD, _REMOVE);
functionBackSlash(Dir: string; Action: BackSlashAction): string; begin case Action of _ADD: begin if Copy(Dir, Length(Dir), 1) = '\' then Result := Dir else Result := Dir + '\'; end; _REMOVE: begin if Copy(Dir, Length(Dir), 1) = '\' then Result := Copy(Dir, 1, Length(Dir)-1) else Result := Dir; end; end; end;