-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Filesystem] Add $fs->join([$pathSegment]) #26523
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
Comments
For reference, in Go there's a core package called Path that contains a
func Join(elem ...string) string Example: package main
import (
"fmt"
"path"
)
func main() {
fmt.Println(path.Join("a", "b", "c"))
fmt.Println(path.Join("a", "b/c"))
fmt.Println(path.Join("a/b", "c"))
fmt.Println(path.Join("", ""))
fmt.Println(path.Join("a", ""))
fmt.Println(path.Join("", "a"))
}
a/b/c
a/b/c
a/b/c
a
a If we decide to do the same, I propose this:
|
Let me know when you feel like it's ready and discussed enough for a PR. |
This exists in node as well and is called |
This also exists in python |
Can we move forward on this ? |
I'll be happy to implement what @javiereguiluz proposed. I think that (at least in the first iteration) it shouldn't be too clever and merge |
@tomasfejfar go for it (when you have time), if you need any help you can ask me ! |
Thank you for this suggestion. |
+1 to this feature 👍 |
Thank you for this suggestion. |
Yes. |
#30969 this one is much further... |
Is there anyone up to take over that PR or create a new PR for this issue? If you need help with the contribution process, feel free to hop into the #contribs channel on Symfony Slack. |
Ah, I see @theofidry restarted the PR himself. Thanks! |
When working with filesystem it's always very cumbersome to create path from different segments. For example, create full path from base directory, subdirectory and filename. Especially if you need to compare paths later.
What I propose is to add
$filesystem->join()
method. It's purpose would be to merge different path segment with path separator in a predictable way.What do you think? I'd be happy to send a PR after it's disussed.
The text was updated successfully, but these errors were encountered: