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

Slashing on Windows for Zip issue #47

Closed
vogtdominikgit opened this issue Feb 18, 2016 · 4 comments
Closed

Slashing on Windows for Zip issue #47

vogtdominikgit opened this issue Feb 18, 2016 · 4 comments

Comments

@vogtdominikgit
Copy link

Hey, just wanted to let you know that i found an issue for windows.

PassFactory seems to have a problem in the zip() function at Line 362 where the slashes for UNIX are brought in the right direction. But for Windows this causes an issue.

So i added $file = str_replace('', '/', $file); directly after this line, to solve this issue.

Im not sure how to add a pull request. So this is how im letting you know.

@g-
Copy link
Collaborator

g- commented Feb 19, 2016

I see your point. The documentation for realpath() says:

On windows realpath() will change unix style paths to windows style.

I'd imagine the same normalisation as used above in the code would be required:

$file = str_replace('\\', '/', $file);

@vogtdominikgit
Copy link
Author

I am writing just now, because i have this issue again. I could solve it with.

$file = str_replace('\\', DIRECTORY_SEPARATOR, $file);

Just use the PHP Constant for each '/' inside the zip function.

@g-
Copy link
Collaborator

g- commented Mar 23, 2016

Yes, it would definitely be better to use DIRECTORY_SEPARATOR rather than str_replace all over the place.

@g-
Copy link
Collaborator

g- commented Mar 23, 2016

Even better would be to use the getSubPathName() method of the RecursiveDirectoryIterator to avoid string manipulation to get the relative path. I've rewritten the method using this approach. Could you check that it works for you?

@g- g- closed this as completed in cce73c7 Mar 23, 2016
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