-
Notifications
You must be signed in to change notification settings - Fork 58
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
Fix for specifying a directory in a package when deploying from windows #73
Conversation
Thanks for continuing to run this down. What a pain! The only thing I can't quite figure out is if this solves for directory separators in the path? I see that the last one between the path and the directory is replaced, but what about ones in the path? I'm wondering if we should do something like str_replace(DIRECTORY_SEPARATOR, "/", $file->getPathname()) that would ensure we get them all, right? Lemme know what you think about that! |
I'm not sure where is the best place for some of these fixes, this first PR looked like the main place however didn't resolve folders, because it looks like the Finder path for the file seemed to be So if I'm understanding you correctly, the downstream fix of detecting any |
ok did a quick test, fixing all |
I wonder if we should just do the directory replacement as the file is going into the zip? That way PHP can always read from the filesystem, and Lambda always ends up with Would that solve it in every case? |
Adding your suggested fix to $zip->addFileFromPath(
str_replace(DIRECTORY_SEPARATOR, '/', $this->removeBasePath($file)), $file, $options
); Thats for the Likely need to also change the other You can also revert the previous DIRECTORY_SEPARATOR change along with not using this suggested PR. I can make a new PR if you want. |
Nice! I think this is the way to go. Maybe we add a new method, something like |
Ok think I've updated this PR, added |
Thanks for seeing this through! 💪 |
When using specifying a directory in the package function windows paths becomes a mix of \ and /.
This commit changes the way the Finder class retrieves the path.
Since
SplFileInfo::getPathname
returns a mixture of paths on windows and creating zips on windows really likes / . I replaced the call togetPathname()
with$file->getPath() . '/'. $file->getFilename()
both functions onSplFileInfo
This means the \ that gets added between the folder and file in question is always a /.
This change may need testing on other platforms but should be okay.