Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Refactored the makePathRelative function #4842

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 11, 2012
Merged

Refactored the makePathRelative function #4842

merged 1 commit into from
Jul 11, 2012

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
Morty Proxy This is a proxified and sanitized view of the page, visit original site.