Skip to content

Commit

Permalink
use dir instead of allinfo where possible
Browse files Browse the repository at this point in the history
  • Loading branch information
icewind1991 committed Feb 6, 2019
1 parent 10fadc4 commit 4d0e89e
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/Share.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,19 @@ public function dir($path) {
* @return \Icewind\SMB\IFileInfo
*/
public function stat($path) {
// some windows server setups don't seem to like the allinfo command
// use the dir command instead to get the file info where possible
if ($path !== "" && $path !== "/") {
$parent = dirname($path);
$dir = $this->dir($parent);
$file = array_values(array_filter($dir, function(IFileInfo $info) use ($path) {
return $info->getPath() === $path;
}));
if ($file) {
return $file[0];
}
}

$escapedPath = $this->escapePath($path);
$output = $this->execute('allinfo ' . $escapedPath);
// Windows and non Windows Fileserver may respond different
Expand Down

0 comments on commit 4d0e89e

Please sign in to comment.