Commit f8d7dc15 authored by Julien Fontanet's avatar Julien Fontanet

fix(rmdir): dont test existence

Similar to 4b8f5754
parent fd95d450
...@@ -18,34 +18,27 @@ var BigInt = require('../tools/bigint'); ...@@ -18,34 +18,27 @@ var BigInt = require('../tools/bigint');
module.exports = function unlink(path, cb) { module.exports = function unlink(path, cb) {
var connection = this; var connection = this;
connection.exists(path, function(err, exists) { // SMB2 open file
SMB2Request('create', { path: path }, connection, function(err, file) {
if (err) cb && cb(err); if (err) cb && cb(err);
else if (exists) { // SMB2 query directory
// SMB2 open file else
SMB2Request('create', { path: path }, connection, function(err, file) { SMB2Request(
if (err) cb && cb(err); 'set_info',
// SMB2 query directory {
else FileId: file.FileId,
SMB2Request( FileInfoClass: 'FileDispositionInformation',
'set_info', Buffer: new BigInt(1, 1).toBuffer(),
{ },
FileId: file.FileId, connection,
FileInfoClass: 'FileDispositionInformation', function(err, files) {
Buffer: new BigInt(1, 1).toBuffer(), if (err) cb && cb(err);
}, // SMB2 close directory
connection, else
function(err, files) { SMB2Request('close', file, connection, function() {
if (err) cb && cb(err); cb && cb(null, files);
// SMB2 close directory });
else }
SMB2Request('close', file, connection, function() { );
cb && cb(null, files);
});
}
);
});
} else {
cb(new Error('File does not exists'));
}
}); });
}; };
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment