Skip to content
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

Path shortening on Windows has (usual) separator issues #41

Closed
Rarst opened this issue Jan 10, 2013 · 3 comments
Closed

Path shortening on Windows has (usual) separator issues #41

Rarst opened this issue Jan 10, 2013 · 3 comments

Comments

@Rarst
Copy link
Contributor

Rarst commented Jan 10, 2013

When running PHP on Windows - between server configuration, PHP functions and PHP code paths end up containing most exotic combinations of back and forward slashes.

As result kint's shorten path functionality tends to not work.

It is good practice to equalize all slashes when running comparisons and/or replacements on filesystem paths:

    public static function shortenPath( $file, $line = null )
    {
        $file          = str_replace( '\\', '/', $file );
        $shortenedName = $file;
        foreach ( self::$appRootDirs as $path => $replaceString ) {
            $path = str_replace( '\\', '/', $path );
@raveren
Copy link
Contributor

raveren commented Jan 15, 2013

Thanks! Loled at

exotic combinations of back and forward slashes

The path feature has been rewritten multiple times, and it must have lost the slash equalization in some iteration.

@raveren raveren closed this as completed Jan 15, 2013
@Rarst
Copy link
Contributor Author

Rarst commented Jan 15, 2013

Looking at commit - also replace slashes in $path of loop below. It comes from user configuration so can be... exotic as well. :)

@raveren
Copy link
Contributor

raveren commented Jan 15, 2013

Good catch, thanks again!

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

No branches or pull requests

2 participants