-
Notifications
You must be signed in to change notification settings - Fork 10
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
Test Cp Step #58
base: trunk
Are you sure you want to change the base?
Test Cp Step #58
Conversation
|
||
try { | ||
// TODO affirm it should overwrite newer files | ||
// Filesystem's copy requires flag `overwriteNewerFiles` set to `true` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What are "newer" files? Is the timestamp compared?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Excerpt from the Filesystem docs:
If the target file is older than the origin file, it's always overwritten. If the target file is newer, it is overwritten only when the $overwriteNewerFiles option is set to true.
I'd assume the steps should just do as they are told. Therefore, this suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, let's ignore the timestamps and just overwrite any pre-existing files
// Filesystem's copy requires flag `overwriteNewerFiles` set to `true` | ||
|
||
// TODO affirm it should copy file to directory | ||
// copy throws an exception when $resolvedToPath is a directory - linux would handle this: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah that would be useful.
// of a path to a directory, then the program copies each source file to the destination directory, | ||
// creating any files not already existing. | ||
|
||
// TODO affirm it should copy all files from one directory to another (also, ponder recursivity) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This would be highly useful as well.
// while a new directory is created if the destination does not exist. | ||
|
||
// TODO establish how $input->toPath should be handled | ||
// should copy to document root when null or when ""? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's assume all the paths are relative to the document root. ""
means "document root". null
should be rejected during validation and never make it to this function.
🚧 Work in progress 🚧
Filesystem's copy requires flag
overwriteNewerFiles
set totrue
copy throws an exception when $resolvedToPath is a directory - linux would handle this:
When the program has one or more arguments of path names of files and following those an argument
of a path to a directory, then the program copies each source file to the destination directory,
creating any files not already existing.
copy throws an exception when $resolvedToPath or $resolvedFromPath are directories - linux would
handle this:
When the program's arguments are the path names to two directories,
cp copies all files in the source directory to the destination directory,
creating any files or directories needed. This mode of operation requires an additional option flag,
typically r, to indicate the recursive copying of directories.
If the destination directory already exists, the source is copied into the destination,
while a new directory is created if the destination does not exist.
should copy to document root when null or when ""?
I've pondered it for a moment or two. And I think the right way forward here is to implement our own copy method.
My reasoning:
Currently the cp step copies only form one file path to another (both have to be files).