Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@aharonp
Copy link
Contributor

@aharonp aharonp commented Jul 10, 2012

The function was failing in a number of different use cases because the function was incorrectly using a character offset comparison to determine where the common path stops.

I've fixed this by splitting up the paths into their individual directories and then comparing the directory names.

If the paths match then the function will return ./ and not an empty string. This is for consistency sake, to ensure all returned paths end with /.

fabpot added a commit that referenced this pull request Jul 11, 2012
Commits
-------

6def8d1 Refactored Filesystem::makePathRelative function to correctly handle more use-cases

Discussion
----------

Refactored the makePathRelative function

The function was failing in a number of different use cases because the function was incorrectly using a character offset comparison to determine where the common path stops.

I've fixed this by splitting up the paths into their individual directories and then comparing the directory names.

If the paths match then the function will return `./` and not an empty string. This is for consistency sake, to ensure all returned paths end with `/`.
@fabpot fabpot merged commit 6def8d1 into symfony:master Jul 11, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants