Skip to content

Commit

Permalink
Hacky and quick fix for issue #1
Browse files Browse the repository at this point in the history
  • Loading branch information
cedricblondeau committed Mar 27, 2016
1 parent 4e9f5e3 commit e753bee
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Model/Import.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit e753bee

Please sign in to comment.