-function put(filePath, otherFilePaths, options) {
- checkConfig();
-
- var destination = '';
-
- // take the last argument as destination
- if (otherFilePaths.length > 0) {
- destination = otherFilePaths.pop();
- if (otherFilePaths.length > 0 && destination[destination.length-1] !== '/') destination += '/';
+function putOne(filePath, destination, options, callback) {
+ const absoluteFilePath = path.resolve(filePath);
+ const stat = safe.fs.statSync(absoluteFilePath);
+ if (!stat) return callback(`Could not stat ${filePath}: ${safe.error.message}`);
+
+ let files, base;
+
+ if (stat.isFile()) {
+ base = destination + path.basename(filePath);
+ files = [ absoluteFilePath ];
+ } else if (stat.isDirectory()) {
+ base = destination + (filePath.endsWith('.') ? '' : path.basename(filePath) + '/');
+ files = collectFiles([ absoluteFilePath ], options);
+ } else {
+ return callback(); // ignore