Remove duplicate decls across filesystem/*

This commit is contained in:
David Humphrey (:humph) david.humphrey@senecacollege.ca 2014-03-18 14:31:38 -04:00
parent 87fd1465f7
commit b73678c5c0
2 changed files with 5 additions and 80 deletions

View File

@ -1,32 +1,26 @@
define(function(require) { define(function(require) {
var _ = require('nodash');
// TextEncoder and TextDecoder will either already be present, or use this shim. // TextEncoder and TextDecoder will either already be present, or use this shim.
// Because of the way the spec is defined, we need to get them off the global. // Because of the way the spec is defined, we need to get them off the global.
require('encoding'); require('encoding');
var _ = require('nodash');
var normalize = require('src/path').normalize; var normalize = require('src/path').normalize;
var dirname = require('src/path').dirname; var dirname = require('src/path').dirname;
var basename = require('src/path').basename; var basename = require('src/path').basename;
var isAbsolutePath = require('src/path').isAbsolute; var isAbsolutePath = require('src/path').isAbsolute;
var isNullPath = require('src/path').isNull; var isNullPath = require('src/path').isNull;
var hash = require('src/shared').hash;
var nop = require('src/shared').nop;
var FILE_SYSTEM_NAME = require('src/constants').FILE_SYSTEM_NAME;
var FS_FORMAT = require('src/constants').FS_FORMAT;
var MODE_FILE = require('src/constants').MODE_FILE; var MODE_FILE = require('src/constants').MODE_FILE;
var MODE_DIRECTORY = require('src/constants').MODE_DIRECTORY; var MODE_DIRECTORY = require('src/constants').MODE_DIRECTORY;
var MODE_SYMBOLIC_LINK = require('src/constants').MODE_SYMBOLIC_LINK; var MODE_SYMBOLIC_LINK = require('src/constants').MODE_SYMBOLIC_LINK;
var MODE_META = require('src/constants').MODE_META; var MODE_META = require('src/constants').MODE_META;
var ROOT_DIRECTORY_NAME = require('src/constants').ROOT_DIRECTORY_NAME; var ROOT_DIRECTORY_NAME = require('src/constants').ROOT_DIRECTORY_NAME;
var SUPER_NODE_ID = require('src/constants').SUPER_NODE_ID; var SUPER_NODE_ID = require('src/constants').SUPER_NODE_ID;
var SYMLOOP_MAX = require('src/constants').SYMLOOP_MAX; var SYMLOOP_MAX = require('src/constants').SYMLOOP_MAX;
var FS_READY = require('src/constants').FS_READY;
var FS_PENDING = require('src/constants').FS_PENDING;
var FS_ERROR = require('src/constants').FS_ERROR;
var O_READ = require('src/constants').O_READ; var O_READ = require('src/constants').O_READ;
var O_WRITE = require('src/constants').O_WRITE; var O_WRITE = require('src/constants').O_WRITE;
var O_CREATE = require('src/constants').O_CREATE; var O_CREATE = require('src/constants').O_CREATE;
@ -34,17 +28,12 @@ define(function(require) {
var O_TRUNCATE = require('src/constants').O_TRUNCATE; var O_TRUNCATE = require('src/constants').O_TRUNCATE;
var O_APPEND = require('src/constants').O_APPEND; var O_APPEND = require('src/constants').O_APPEND;
var O_FLAGS = require('src/constants').O_FLAGS; var O_FLAGS = require('src/constants').O_FLAGS;
var XATTR_CREATE = require('src/constants').XATTR_CREATE; var XATTR_CREATE = require('src/constants').XATTR_CREATE;
var XATTR_REPLACE = require('src/constants').XATTR_REPLACE; var XATTR_REPLACE = require('src/constants').XATTR_REPLACE;
var FS_NOMTIME = require('src/constants').FS_NOMTIME; var FS_NOMTIME = require('src/constants').FS_NOMTIME;
var FS_NOCTIME = require('src/constants').FS_NOCTIME; var FS_NOCTIME = require('src/constants').FS_NOCTIME;
var providers = require('src/providers/providers');
var adapters = require('src/adapters/adapters');
var Shell = require('src/shell');
var Intercom = require('intercom');
var FSWatcher = require('src/fs-watcher');
var Errors = require('src/errors'); var Errors = require('src/errors');
var DirectoryEntry = require('src/directory-entry'); var DirectoryEntry = require('src/directory-entry');
var OpenFileDescription = require('src/open-file-description'); var OpenFileDescription = require('src/open-file-description');

View File

@ -2,40 +2,14 @@ define(function(require) {
var _ = require('nodash'); var _ = require('nodash');
// TextEncoder and TextDecoder will either already be present, or use this shim.
// Because of the way the spec is defined, we need to get them off the global.
require('encoding');
var normalize = require('src/path').normalize;
var dirname = require('src/path').dirname;
var basename = require('src/path').basename;
var isAbsolutePath = require('src/path').isAbsolute;
var isNullPath = require('src/path').isNull; var isNullPath = require('src/path').isNull;
var hash = require('src/shared').hash;
var nop = require('src/shared').nop; var nop = require('src/shared').nop;
var FILE_SYSTEM_NAME = require('src/constants').FILE_SYSTEM_NAME; var FILE_SYSTEM_NAME = require('src/constants').FILE_SYSTEM_NAME;
var FS_FORMAT = require('src/constants').FS_FORMAT; var FS_FORMAT = require('src/constants').FS_FORMAT;
var MODE_FILE = require('src/constants').MODE_FILE;
var MODE_DIRECTORY = require('src/constants').MODE_DIRECTORY;
var MODE_SYMBOLIC_LINK = require('src/constants').MODE_SYMBOLIC_LINK;
var MODE_META = require('src/constants').MODE_META;
var ROOT_DIRECTORY_NAME = require('src/constants').ROOT_DIRECTORY_NAME;
var SUPER_NODE_ID = require('src/constants').SUPER_NODE_ID;
var SYMLOOP_MAX = require('src/constants').SYMLOOP_MAX;
var FS_READY = require('src/constants').FS_READY; var FS_READY = require('src/constants').FS_READY;
var FS_PENDING = require('src/constants').FS_PENDING; var FS_PENDING = require('src/constants').FS_PENDING;
var FS_ERROR = require('src/constants').FS_ERROR; var FS_ERROR = require('src/constants').FS_ERROR;
var O_READ = require('src/constants').O_READ;
var O_WRITE = require('src/constants').O_WRITE;
var O_CREATE = require('src/constants').O_CREATE;
var O_EXCLUSIVE = require('src/constants').O_EXCLUSIVE;
var O_TRUNCATE = require('src/constants').O_TRUNCATE;
var O_APPEND = require('src/constants').O_APPEND;
var O_FLAGS = require('src/constants').O_FLAGS;
var XATTR_CREATE = require('src/constants').XATTR_CREATE;
var XATTR_REPLACE = require('src/constants').XATTR_REPLACE;
var FS_NOMTIME = require('src/constants').FS_NOMTIME; var FS_NOMTIME = require('src/constants').FS_NOMTIME;
var FS_NOCTIME = require('src/constants').FS_NOCTIME; var FS_NOCTIME = require('src/constants').FS_NOCTIME;
@ -46,48 +20,10 @@ define(function(require) {
var Intercom = require('intercom'); var Intercom = require('intercom');
var FSWatcher = require('src/fs-watcher'); var FSWatcher = require('src/fs-watcher');
var Errors = require('src/errors'); var Errors = require('src/errors');
var DirectoryEntry = require('src/directory-entry');
var OpenFileDescription = require('src/open-file-description');
var SuperNode = require('src/super-node');
var Node = require('src/node');
var Stats = require('src/stats');
// The core fs operations live on impl // The core fs operations live on impl
var impl = require('src/filesystem/implementation'); var impl = require('src/filesystem/implementation');
function validate_flags(flags) {
if(!_(O_FLAGS).has(flags)) {
return null;
}
return O_FLAGS[flags];
}
function validate_file_options(options, enc, fileMode){
if(!options) {
options = { encoding: enc, flag: fileMode };
} else if(typeof options === "function") {
options = { encoding: enc, flag: fileMode };
} else if(typeof options === "string") {
options = { encoding: options, flag: fileMode };
}
return options;
}
function pathCheck(path, callback) {
var err;
if(isNullPath(path)) {
err = new Error('Path must be a string without null bytes.');
} else if(!isAbsolutePath(path)) {
err = new Error('Path must be absolute.');
}
if(err) {
callback(err);
return false;
}
return true;
}
// node.js supports a calling pattern that leaves off a callback. // node.js supports a calling pattern that leaves off a callback.
function maybeCallback(callback) { function maybeCallback(callback) {
if(typeof callback === "function") { if(typeof callback === "function") {