cmd: Add a helper function to check if a path ends with a backslash.