Note: this assignment was moved down so that it happens only after a test that ensures `path` is non-empty.