diff --git a/Model/Import.php b/Model/Import.php index 50bfdf7..930159a 100644 --- a/Model/Import.php +++ b/Model/Import.php @@ -61,17 +61,19 @@ public function __construct( } /** - * @param $fileName + * @param $filePath Absolute file path to CSV file */ - public function setFile($fileName) + public function setFile($filePath) { - if (!file_exists($fileName)) { + if (!file_exists($filePath)) { throw new FileNotFoundException(); } + // Hacky but quick fix for https://github.com/cedricblondeau/magento2-module-catalog-import-command/issues/1 + $pathInfo = pathinfo($filePath); $validate = $this->importModel->validateSource($this->csvSourceFactory->create( [ - 'file' => $fileName, - 'directory' => $this->readFactory->create('/') + 'file' => $pathInfo['basename'], + 'directory' => $this->readFactory->create($pathInfo['dirname']) ] )); if (!$validate) {