Fix directory detection through symlinks #127
Closed
+222
−3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Initially this PR (#125) was meant to correct an issue on Windows where symlink'd directories would be considered neither as a directory, nor a symlink.
It has since grown to ensure that symlink'd directories are properly exported on both Windows and UNIX platforms. This is important as
php artisan storage:link
creates such a symlink and users will very likely want to export it as if it was a regular directory.On Windows, stepping into a debugger revealed that
SplFileInfo::isDir()
,SplFileInfo::isFile()
andSplFileInfo::isLink()
all returned false on that specific entry. On UNIX platforms,SplFileInfo::isDir()
andSplFileInfo::isLink()
both return true whereSplFileInfo::isFile()
returns false.However,
SplFileInfo::getRealPath()
does yield the correct directory path (i.e. the one the symlink points to).As such, this PR simply makes directory detection portable on all OS that could suffer from this specific issue without hindering the process for other types of files.