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

Make directory check portable #332

Merged
merged 2 commits into from Dec 8, 2017

Conversation

Projects
None yet
2 participants
@friscoMad
Collaborator

friscoMad commented Dec 7, 2017

Description

The current function did not work properly on Windows as there is a mismatch on slashes between what was returned by dirname and document_root.

Motivation and Context

Helping to setup an installation in Windows I needed to debug why all links were using the local path which lead to finding this.

How Has This Been Tested?

Tested in a no subdir windows install, SO says that's the really portable way to do with 20 upvotes but not really tested outside that installation.

Screenshots (if appropriate):

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
Make directory check portable
The current function did not work properly on Windows as there is a mismatch on slashes between what was returned by dirname and document_root.

@Obihoernchen Obihoernchen self-assigned this Dec 8, 2017

@Obihoernchen

Obihoernchen requested changes Dec 8, 2017 edited

This results in a double / on linux. See: [...].net//pokemon_dev/pokemon.

@Obihoernchen Obihoernchen added the WIP label Dec 8, 2017

Fix ending slash
dirname is always a dir ending with slash while DOCUMENT_ROOT seems to avoid the last slash, so just adding + 1 to the substr should be enough to remove it.
@friscoMad

This comment has been minimized.

Collaborator

friscoMad commented Dec 8, 2017

I think I fixed that last slash, still not tested (I am working abroad with no access to my dev env) this also includes #333 fix.

@Obihoernchen Obihoernchen merged commit 51910d5 into brusselopole:master Dec 8, 2017

javisabalete added a commit to javisabalete/Worldopole that referenced this pull request Jan 29, 2018

Make directory check portable (brusselopole#332)
* Make directory check portable

The current function did not work properly on Windows as there is a mismatch on slashes between what was returned by dirname and document_root.

* Fix ending slash

dirname is always a dir ending with slash while DOCUMENT_ROOT seems to avoid the last slash, so just adding + 1 to the substr should be enough to remove it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment