Skip to content

Commit

Permalink
Attempt to fix eldargab#3: eldargab#3
Browse files Browse the repository at this point in the history
  • Loading branch information
kdvolder committed Feb 22, 2013
1 parent 8e3ae86 commit 4682293
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions lib/fake-fs.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
/*******************************************************************************
* @license
* Copyright (c) 2013 VMware, Inc. All Rights Reserved.
* THIS FILE IS PROVIDED UNDER THE TERMS OF THE ECLIPSE PUBLIC LICENSE
* ("AGREEMENT"). ANY USE, REPRODUCTION OR DISTRIBUTION OF THIS FILE
* CONSTITUTES RECIPIENTS ACCEPTANCE OF THE AGREEMENT.
* You can obtain a current copy of the Eclipse Public License from
* http://www.opensource.org/licenses/eclipse-1.0.php
*
* Contributors:
* Kris De Volder
******************************************************************************/
var stat = require('./stat')
var PATH = require('path')
var normalize = PATH.normalize
Expand Down Expand Up @@ -111,12 +123,24 @@ Fs.prototype.mkdirSync = function (dir, mode) {
this.dir(dir)
}

Fs.prototype._isEmtpy = function() {
var children = this.childs || {};
for (var name in children) {
if (children[name]) {
return true;
}
}
return false;
};

Fs.prototype.rmdirSync = function (path) {
if (!this.existsSync(path)) throw FsError('ENOENT');

var item = this._get(path);
if (!item.isDirectory()) throw FsError('ENOTDIR');

if (!item._isEmpty()) throw FsError('ENOTEMPTY');

var parent = this._get(dirname(path));
updateTimes(parent);
this._rem(path);
Expand Down

0 comments on commit 4682293

Please sign in to comment.