mirror of
https://github.com/fuse-friends/fuse-native
synced 2024-10-27 18:34:01 +00:00
clean up #7
This commit is contained in:
parent
e7f5308ee5
commit
f6fe161228
@ -1,6 +1,6 @@
|
||||
var fuse = require('./')
|
||||
|
||||
var mountPath = process.platform !== 'win32' ? './mnt' : 'M:\\';
|
||||
var mountPath = process.platform !== 'win32' ? './mnt' : 'M:\\'
|
||||
|
||||
fuse.mount(mountPath, {
|
||||
readdir: function (path, cb) {
|
||||
|
@ -672,6 +672,7 @@ static thread_fn_rtn_t bindings_thread (void *data) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifndef _WIN32
|
||||
NAN_INLINE static Local<Date> bindings_get_date (struct timespec *out) {
|
||||
int ms = (out->tv_nsec / 1000);
|
||||
return NanNew<Date>(out->tv_sec * 1000 + ms);
|
||||
@ -685,7 +686,7 @@ NAN_INLINE static void bindings_set_date (struct timespec *out, Local<Date> date
|
||||
out->tv_sec = secs;
|
||||
out->tv_nsec = ns;
|
||||
}
|
||||
|
||||
#else
|
||||
NAN_INLINE static Local<Date> bindings_get_date (time_t *out) {
|
||||
return NanNew<Date>(*out * 1000.0);
|
||||
}
|
||||
@ -695,6 +696,7 @@ NAN_INLINE static void bindings_set_date (time_t *out, Local<Date> date) {
|
||||
time_t secs = (time_t)(ms / 1000.0);
|
||||
*out = secs;
|
||||
}
|
||||
#endif
|
||||
|
||||
NAN_INLINE static void bindings_set_stat (struct stat *stat, Local<Object> obj) {
|
||||
if (obj->Has(NanNew<String>("dev"))) stat->st_dev = obj->Get(NanNew<String>("dev"))->NumberValue();
|
||||
|
5
index.js
5
index.js
@ -69,7 +69,7 @@ exports.mount = function (mnt, ops, cb) {
|
||||
|
||||
var mount = function () {
|
||||
// TODO: I got a feeling this can be done better
|
||||
if(os.platform() !== 'win32') {
|
||||
if (os.platform() !== 'win32') {
|
||||
fs.stat(mnt, function (err, stat) {
|
||||
if (err) return cb(new Error('Mountpoint does not exist'))
|
||||
if (!stat.isDirectory()) return cb(new Error('Mountpoint is not a directory'))
|
||||
@ -78,8 +78,9 @@ exports.mount = function (mnt, ops, cb) {
|
||||
fuse.mount(mnt, ops)
|
||||
})
|
||||
})
|
||||
} else {
|
||||
fuse.mount(mnt, ops)
|
||||
}
|
||||
else fuse.mount(mnt, ops)
|
||||
}
|
||||
|
||||
if (!ops.force) return mount()
|
||||
|
Loading…
Reference in New Issue
Block a user