2013-03-24 12:22:21 +00:00
|
|
|
/*\
|
|
|
|
title: $:/plugins/tiddlywiki/filesystem/filesystemadaptor.js
|
|
|
|
type: application/javascript
|
|
|
|
module-type: syncadaptor
|
|
|
|
|
2014-08-14 10:12:25 +00:00
|
|
|
A sync adaptor module for synchronising with the local filesystem via node.js APIs
|
2013-03-24 12:22:21 +00:00
|
|
|
|
|
|
|
\*/
|
|
|
|
(function(){
|
|
|
|
|
|
|
|
/*jslint node: true, browser: true */
|
|
|
|
/*global $tw: false */
|
|
|
|
"use strict";
|
|
|
|
|
|
|
|
// Get a reference to the file system
|
2014-12-18 19:52:15 +00:00
|
|
|
var fs = $tw.node ? require("fs") : null,
|
|
|
|
path = $tw.node ? require("path") : null;
|
2013-10-11 21:10:10 +00:00
|
|
|
|
2014-08-14 10:12:25 +00:00
|
|
|
function FileSystemAdaptor(options) {
|
2013-10-11 22:43:51 +00:00
|
|
|
var self = this;
|
2014-08-14 10:12:25 +00:00
|
|
|
this.wiki = options.wiki;
|
2017-09-04 13:55:12 +00:00
|
|
|
this.logger = new $tw.utils.Logger("filesystem",{colour: "blue"});
|
2013-12-18 21:11:52 +00:00
|
|
|
// Create the <wiki>/tiddlers folder if it doesn't exist
|
2014-09-28 22:46:55 +00:00
|
|
|
$tw.utils.createDirectory($tw.boot.wikiTiddlersPath);
|
2013-03-24 12:22:21 +00:00
|
|
|
}
|
|
|
|
|
2017-02-04 17:25:30 +00:00
|
|
|
FileSystemAdaptor.prototype.name = "filesystem";
|
|
|
|
|
2016-07-05 10:29:59 +00:00
|
|
|
FileSystemAdaptor.prototype.isReady = function() {
|
|
|
|
// The file system adaptor is always ready
|
|
|
|
return true;
|
|
|
|
};
|
|
|
|
|
2013-03-24 12:22:21 +00:00
|
|
|
FileSystemAdaptor.prototype.getTiddlerInfo = function(tiddler) {
|
|
|
|
return {};
|
|
|
|
};
|
|
|
|
|
2017-02-11 12:56:42 +00:00
|
|
|
/*
|
|
|
|
Return a fileInfo object for a tiddler, creating it if necessary:
|
|
|
|
filepath: the absolute path to the file containing the tiddler
|
|
|
|
type: the type of the tiddler file (NOT the type of the tiddler -- see below)
|
|
|
|
hasMetaFile: true if the file also has a companion .meta file
|
2013-03-25 10:43:46 +00:00
|
|
|
|
2017-02-11 12:56:42 +00:00
|
|
|
The boot process populates $tw.boot.files for each of the tiddler files that it loads. The type is found by looking up the extension in $tw.config.fileExtensionInfo (eg "application/x-tiddler" for ".tid" files).
|
|
|
|
|
|
|
|
It is the responsibility of the filesystem adaptor to update $tw.boot.files for new files that are created.
|
|
|
|
*/
|
2013-03-25 10:43:46 +00:00
|
|
|
FileSystemAdaptor.prototype.getTiddlerFileInfo = function(tiddler,callback) {
|
|
|
|
// See if we've already got information about this file
|
|
|
|
var self = this,
|
|
|
|
title = tiddler.fields.title,
|
|
|
|
fileInfo = $tw.boot.files[title];
|
2017-02-11 12:56:42 +00:00
|
|
|
if(fileInfo) {
|
|
|
|
// If so, just invoke the callback
|
|
|
|
callback(null,fileInfo);
|
|
|
|
} else {
|
|
|
|
// Otherwise, we'll need to generate it
|
|
|
|
fileInfo = {};
|
|
|
|
var tiddlerType = tiddler.fields.type || "text/vnd.tiddlywiki";
|
|
|
|
// Get the content type info
|
|
|
|
var contentTypeInfo = $tw.config.contentTypeInfo[tiddlerType] || {};
|
|
|
|
// Get the file type by looking up the extension
|
|
|
|
var extension = contentTypeInfo.extension || ".tid";
|
2017-02-12 15:35:04 +00:00
|
|
|
fileInfo.type = ($tw.config.fileExtensionInfo[extension] || {type: "application/x-tiddler"}).type;
|
2017-02-11 12:56:42 +00:00
|
|
|
// Use a .meta file unless we're saving a .tid file.
|
|
|
|
// (We would need more complex logic if we supported other template rendered tiddlers besides .tid)
|
2017-02-24 15:36:22 +00:00
|
|
|
fileInfo.hasMetaFile = (fileInfo.type !== "application/x-tiddler") && (fileInfo.type !== "application/json");
|
|
|
|
if(!fileInfo.hasMetaFile) {
|
|
|
|
extension = ".tid";
|
|
|
|
}
|
2017-02-11 12:56:42 +00:00
|
|
|
// Generate the base filepath and ensure the directories exist
|
|
|
|
var baseFilepath = path.resolve($tw.boot.wikiTiddlersPath,this.generateTiddlerBaseFilepath(title));
|
2017-02-12 11:15:23 +00:00
|
|
|
$tw.utils.createFileDirectories(baseFilepath);
|
2013-03-25 10:43:46 +00:00
|
|
|
// Start by getting a list of the existing files in the directory
|
2017-02-11 12:56:42 +00:00
|
|
|
fs.readdir(path.dirname(baseFilepath),function(err,files) {
|
2013-03-25 10:43:46 +00:00
|
|
|
if(err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
2017-02-11 12:56:42 +00:00
|
|
|
// Start with the base filename plus the extension
|
|
|
|
var filepath = baseFilepath;
|
|
|
|
if(filepath.substr(-extension.length).toLocaleLowerCase() !== extension.toLocaleLowerCase()) {
|
|
|
|
filepath = filepath + extension;
|
|
|
|
}
|
|
|
|
var filename = path.basename(filepath),
|
|
|
|
count = 1;
|
|
|
|
// Add a discriminator if we're clashing with an existing filename while
|
|
|
|
// handling case-insensitive filesystems (NTFS, FAT/FAT32, etc.)
|
|
|
|
while(files.some(function(value) {return value.toLocaleLowerCase() === filename.toLocaleLowerCase();})) {
|
|
|
|
filepath = baseFilepath + " " + (count++) + extension;
|
|
|
|
filename = path.basename(filepath);
|
|
|
|
}
|
|
|
|
// Set the final fileInfo
|
|
|
|
fileInfo.filepath = filepath;
|
|
|
|
console.log("\x1b[1;35m" + "For " + title + ", type is " + fileInfo.type + " hasMetaFile is " + fileInfo.hasMetaFile + " filepath is " + fileInfo.filepath + "\x1b[0m");
|
2013-03-25 10:43:46 +00:00
|
|
|
$tw.boot.files[title] = fileInfo;
|
|
|
|
// Pass it to the callback
|
|
|
|
callback(null,fileInfo);
|
|
|
|
});
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
Make tiddler file paths configurable (#2379)
When saving new tiddlers on node.js, allow the user to override the path of the
generated .tid file. This is done by creating a tiddler
$:/config/FileSystemPaths which contains one or more filter expressions, one
per line. These filters are applied in turn to the tiddler to be saved, and
the first output produced is taken as a logical path relative to the wiki's
tiddlers directory. Any occurences of "/" in the logical path are replaced with
the platform's path separator, the extension ".tid" is appended, illegal
characters are replaced by "_" and the path is disambiguated (if necessary) in
order to arrive at the final tiddler file path. If none of the filters matches,
or the configuration tiddler does not exist, fall back to the previous file
naming scheme (i.e. replacing "/" by "_").
This implies we will now, for tiddlers matching the user-specified filters,
create directory trees below the tiddlers directory. In order to avoid
cluttering it with empty directory trees when renaming or removing tiddlers, any
directories that become empty by deleting a tiddler file are removed
(recursively).
Benefits of this configuration option include the ability to organize git
repositories of TiddlyWikis running on node.js, ability to replace characters
that cause trouble with particular operating systems or workflows (e.g. '$' on
unix) and the ability to replicate tiddler "paths" in the filesystem (by
including a filter like "[!has[draft.of]]") without forcing such a (potentially
problematic) change on all users.
2016-04-25 07:36:32 +00:00
|
|
|
/*
|
|
|
|
Given a list of filters, apply every one in turn to source, and return the first result of the first filter with non-empty result.
|
|
|
|
*/
|
|
|
|
FileSystemAdaptor.prototype.findFirstFilter = function(filters,source) {
|
2017-02-11 12:56:42 +00:00
|
|
|
for(var i=0; i<filters.length; i++) {
|
Make tiddler file paths configurable (#2379)
When saving new tiddlers on node.js, allow the user to override the path of the
generated .tid file. This is done by creating a tiddler
$:/config/FileSystemPaths which contains one or more filter expressions, one
per line. These filters are applied in turn to the tiddler to be saved, and
the first output produced is taken as a logical path relative to the wiki's
tiddlers directory. Any occurences of "/" in the logical path are replaced with
the platform's path separator, the extension ".tid" is appended, illegal
characters are replaced by "_" and the path is disambiguated (if necessary) in
order to arrive at the final tiddler file path. If none of the filters matches,
or the configuration tiddler does not exist, fall back to the previous file
naming scheme (i.e. replacing "/" by "_").
This implies we will now, for tiddlers matching the user-specified filters,
create directory trees below the tiddlers directory. In order to avoid
cluttering it with empty directory trees when renaming or removing tiddlers, any
directories that become empty by deleting a tiddler file are removed
(recursively).
Benefits of this configuration option include the ability to organize git
repositories of TiddlyWikis running on node.js, ability to replace characters
that cause trouble with particular operating systems or workflows (e.g. '$' on
unix) and the ability to replicate tiddler "paths" in the filesystem (by
including a filter like "[!has[draft.of]]") without forcing such a (potentially
problematic) change on all users.
2016-04-25 07:36:32 +00:00
|
|
|
var result = this.wiki.filterTiddlers(filters[i],null,source);
|
|
|
|
if(result.length > 0) {
|
|
|
|
return result[0];
|
|
|
|
}
|
|
|
|
}
|
2017-02-11 12:56:42 +00:00
|
|
|
return null;
|
Make tiddler file paths configurable (#2379)
When saving new tiddlers on node.js, allow the user to override the path of the
generated .tid file. This is done by creating a tiddler
$:/config/FileSystemPaths which contains one or more filter expressions, one
per line. These filters are applied in turn to the tiddler to be saved, and
the first output produced is taken as a logical path relative to the wiki's
tiddlers directory. Any occurences of "/" in the logical path are replaced with
the platform's path separator, the extension ".tid" is appended, illegal
characters are replaced by "_" and the path is disambiguated (if necessary) in
order to arrive at the final tiddler file path. If none of the filters matches,
or the configuration tiddler does not exist, fall back to the previous file
naming scheme (i.e. replacing "/" by "_").
This implies we will now, for tiddlers matching the user-specified filters,
create directory trees below the tiddlers directory. In order to avoid
cluttering it with empty directory trees when renaming or removing tiddlers, any
directories that become empty by deleting a tiddler file are removed
(recursively).
Benefits of this configuration option include the ability to organize git
repositories of TiddlyWikis running on node.js, ability to replace characters
that cause trouble with particular operating systems or workflows (e.g. '$' on
unix) and the ability to replicate tiddler "paths" in the filesystem (by
including a filter like "[!has[draft.of]]") without forcing such a (potentially
problematic) change on all users.
2016-04-25 07:36:32 +00:00
|
|
|
};
|
|
|
|
|
2013-03-25 10:43:46 +00:00
|
|
|
/*
|
|
|
|
Given a tiddler title and an array of existing filenames, generate a new legal filename for the title, case insensitively avoiding the array of existing filenames
|
|
|
|
*/
|
2017-02-11 12:56:42 +00:00
|
|
|
FileSystemAdaptor.prototype.generateTiddlerBaseFilepath = function(title) {
|
Make tiddler file paths configurable (#2379)
When saving new tiddlers on node.js, allow the user to override the path of the
generated .tid file. This is done by creating a tiddler
$:/config/FileSystemPaths which contains one or more filter expressions, one
per line. These filters are applied in turn to the tiddler to be saved, and
the first output produced is taken as a logical path relative to the wiki's
tiddlers directory. Any occurences of "/" in the logical path are replaced with
the platform's path separator, the extension ".tid" is appended, illegal
characters are replaced by "_" and the path is disambiguated (if necessary) in
order to arrive at the final tiddler file path. If none of the filters matches,
or the configuration tiddler does not exist, fall back to the previous file
naming scheme (i.e. replacing "/" by "_").
This implies we will now, for tiddlers matching the user-specified filters,
create directory trees below the tiddlers directory. In order to avoid
cluttering it with empty directory trees when renaming or removing tiddlers, any
directories that become empty by deleting a tiddler file are removed
(recursively).
Benefits of this configuration option include the ability to organize git
repositories of TiddlyWikis running on node.js, ability to replace characters
that cause trouble with particular operating systems or workflows (e.g. '$' on
unix) and the ability to replicate tiddler "paths" in the filesystem (by
including a filter like "[!has[draft.of]]") without forcing such a (potentially
problematic) change on all users.
2016-04-25 07:36:32 +00:00
|
|
|
var baseFilename;
|
|
|
|
// Check whether the user has configured a tiddler -> pathname mapping
|
|
|
|
var pathNameFilters = this.wiki.getTiddlerText("$:/config/FileSystemPaths");
|
|
|
|
if(pathNameFilters) {
|
|
|
|
var source = this.wiki.makeTiddlerIterator([title]);
|
2017-02-11 12:56:42 +00:00
|
|
|
baseFilename = this.findFirstFilter(pathNameFilters.split("\n"),source);
|
|
|
|
if(baseFilename) {
|
|
|
|
// Interpret "/" and "\" as path separator
|
|
|
|
baseFilename = baseFilename.replace(/\/|\\/g,path.sep);
|
Make tiddler file paths configurable (#2379)
When saving new tiddlers on node.js, allow the user to override the path of the
generated .tid file. This is done by creating a tiddler
$:/config/FileSystemPaths which contains one or more filter expressions, one
per line. These filters are applied in turn to the tiddler to be saved, and
the first output produced is taken as a logical path relative to the wiki's
tiddlers directory. Any occurences of "/" in the logical path are replaced with
the platform's path separator, the extension ".tid" is appended, illegal
characters are replaced by "_" and the path is disambiguated (if necessary) in
order to arrive at the final tiddler file path. If none of the filters matches,
or the configuration tiddler does not exist, fall back to the previous file
naming scheme (i.e. replacing "/" by "_").
This implies we will now, for tiddlers matching the user-specified filters,
create directory trees below the tiddlers directory. In order to avoid
cluttering it with empty directory trees when renaming or removing tiddlers, any
directories that become empty by deleting a tiddler file are removed
(recursively).
Benefits of this configuration option include the ability to organize git
repositories of TiddlyWikis running on node.js, ability to replace characters
that cause trouble with particular operating systems or workflows (e.g. '$' on
unix) and the ability to replicate tiddler "paths" in the filesystem (by
including a filter like "[!has[draft.of]]") without forcing such a (potentially
problematic) change on all users.
2016-04-25 07:36:32 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
if(!baseFilename) {
|
2017-02-11 12:56:42 +00:00
|
|
|
// No mappings provided, or failed to match this tiddler so we use title as filename
|
|
|
|
baseFilename = title.replace(/\/|\\/g,"_");
|
Make tiddler file paths configurable (#2379)
When saving new tiddlers on node.js, allow the user to override the path of the
generated .tid file. This is done by creating a tiddler
$:/config/FileSystemPaths which contains one or more filter expressions, one
per line. These filters are applied in turn to the tiddler to be saved, and
the first output produced is taken as a logical path relative to the wiki's
tiddlers directory. Any occurences of "/" in the logical path are replaced with
the platform's path separator, the extension ".tid" is appended, illegal
characters are replaced by "_" and the path is disambiguated (if necessary) in
order to arrive at the final tiddler file path. If none of the filters matches,
or the configuration tiddler does not exist, fall back to the previous file
naming scheme (i.e. replacing "/" by "_").
This implies we will now, for tiddlers matching the user-specified filters,
create directory trees below the tiddlers directory. In order to avoid
cluttering it with empty directory trees when renaming or removing tiddlers, any
directories that become empty by deleting a tiddler file are removed
(recursively).
Benefits of this configuration option include the ability to organize git
repositories of TiddlyWikis running on node.js, ability to replace characters
that cause trouble with particular operating systems or workflows (e.g. '$' on
unix) and the ability to replicate tiddler "paths" in the filesystem (by
including a filter like "[!has[draft.of]]") without forcing such a (potentially
problematic) change on all users.
2016-04-25 07:36:32 +00:00
|
|
|
}
|
|
|
|
// Remove any of the characters that are illegal in Windows filenames
|
2017-02-11 12:56:42 +00:00
|
|
|
var baseFilename = $tw.utils.transliterate(baseFilename.replace(/<|>|\:|\"|\||\?|\*|\^/g,"_"));
|
2013-03-25 10:43:46 +00:00
|
|
|
// Truncate the filename if it is too long
|
|
|
|
if(baseFilename.length > 200) {
|
2015-01-02 17:25:54 +00:00
|
|
|
baseFilename = baseFilename.substr(0,200);
|
2013-03-25 10:43:46 +00:00
|
|
|
}
|
2017-02-11 12:56:42 +00:00
|
|
|
return baseFilename;
|
2013-03-25 10:43:46 +00:00
|
|
|
};
|
|
|
|
|
2013-03-24 12:22:21 +00:00
|
|
|
/*
|
|
|
|
Save a tiddler and invoke the callback with (err,adaptorInfo,revision)
|
|
|
|
*/
|
|
|
|
FileSystemAdaptor.prototype.saveTiddler = function(tiddler,callback) {
|
2013-10-11 21:10:10 +00:00
|
|
|
var self = this;
|
2013-03-25 10:43:46 +00:00
|
|
|
this.getTiddlerFileInfo(tiddler,function(err,fileInfo) {
|
|
|
|
if(err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
2017-02-11 12:56:42 +00:00
|
|
|
var filepath = fileInfo.filepath,
|
|
|
|
error = $tw.utils.createDirectory(path.dirname(filepath));
|
Make tiddler file paths configurable (#2379)
When saving new tiddlers on node.js, allow the user to override the path of the
generated .tid file. This is done by creating a tiddler
$:/config/FileSystemPaths which contains one or more filter expressions, one
per line. These filters are applied in turn to the tiddler to be saved, and
the first output produced is taken as a logical path relative to the wiki's
tiddlers directory. Any occurences of "/" in the logical path are replaced with
the platform's path separator, the extension ".tid" is appended, illegal
characters are replaced by "_" and the path is disambiguated (if necessary) in
order to arrive at the final tiddler file path. If none of the filters matches,
or the configuration tiddler does not exist, fall back to the previous file
naming scheme (i.e. replacing "/" by "_").
This implies we will now, for tiddlers matching the user-specified filters,
create directory trees below the tiddlers directory. In order to avoid
cluttering it with empty directory trees when renaming or removing tiddlers, any
directories that become empty by deleting a tiddler file are removed
(recursively).
Benefits of this configuration option include the ability to organize git
repositories of TiddlyWikis running on node.js, ability to replace characters
that cause trouble with particular operating systems or workflows (e.g. '$' on
unix) and the ability to replicate tiddler "paths" in the filesystem (by
including a filter like "[!has[draft.of]]") without forcing such a (potentially
problematic) change on all users.
2016-04-25 07:36:32 +00:00
|
|
|
if(error) {
|
|
|
|
return callback(error);
|
|
|
|
}
|
2017-02-11 12:56:42 +00:00
|
|
|
if(fileInfo.hasMetaFile) {
|
2013-03-25 12:11:34 +00:00
|
|
|
// Save the tiddler as a separate body and meta file
|
2017-02-11 12:56:42 +00:00
|
|
|
var typeInfo = $tw.config.contentTypeInfo[tiddler.fields.type || "text/plain"] || {encoding: "utf8"};
|
2016-07-20 15:07:28 +00:00
|
|
|
fs.writeFile(filepath,tiddler.fields.text,{encoding: typeInfo.encoding},function(err) {
|
2013-03-25 12:11:34 +00:00
|
|
|
if(err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
2014-08-14 10:12:25 +00:00
|
|
|
content = self.wiki.renderTiddler("text/plain","$:/core/templates/tiddler-metadata",{variables: {currentTiddler: tiddler.fields.title}});
|
2017-02-11 12:56:42 +00:00
|
|
|
fs.writeFile(fileInfo.filepath + ".meta",content,{encoding: "utf8"},function (err) {
|
2013-03-25 12:11:34 +00:00
|
|
|
if(err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
2016-07-20 15:16:21 +00:00
|
|
|
self.logger.log("Saved file",filepath);
|
2017-02-11 12:56:42 +00:00
|
|
|
return callback(null);
|
2013-03-25 12:11:34 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
} else {
|
|
|
|
// Save the tiddler as a self contained templated file
|
2017-02-11 12:56:42 +00:00
|
|
|
var content = self.wiki.renderTiddler("text/plain","$:/core/templates/tid-tiddler",{variables: {currentTiddler: tiddler.fields.title}});
|
2016-07-20 15:07:28 +00:00
|
|
|
fs.writeFile(filepath,content,{encoding: "utf8"},function (err) {
|
2013-03-25 12:11:34 +00:00
|
|
|
if(err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
2016-07-20 15:16:21 +00:00
|
|
|
self.logger.log("Saved file",filepath);
|
2017-02-11 12:56:42 +00:00
|
|
|
return callback(null);
|
2013-03-25 12:11:34 +00:00
|
|
|
});
|
|
|
|
}
|
2013-03-25 10:43:46 +00:00
|
|
|
});
|
2013-03-24 12:22:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
Load a tiddler and invoke the callback with (err,tiddlerFields)
|
2013-12-11 11:45:15 +00:00
|
|
|
|
|
|
|
We don't need to implement loading for the file system adaptor, because all the tiddler files will have been loaded during the boot process.
|
2013-03-24 12:22:21 +00:00
|
|
|
*/
|
|
|
|
FileSystemAdaptor.prototype.loadTiddler = function(title,callback) {
|
2013-12-11 11:45:15 +00:00
|
|
|
callback(null,null);
|
2013-03-24 12:22:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
Delete a tiddler and invoke the callback with (err)
|
|
|
|
*/
|
2014-08-14 10:12:25 +00:00
|
|
|
FileSystemAdaptor.prototype.deleteTiddler = function(title,callback,options) {
|
2013-03-25 20:16:12 +00:00
|
|
|
var self = this,
|
|
|
|
fileInfo = $tw.boot.files[title];
|
|
|
|
// Only delete the tiddler if we have writable information for the file
|
|
|
|
if(fileInfo) {
|
2014-02-06 21:36:30 +00:00
|
|
|
// Delete the file
|
|
|
|
fs.unlink(fileInfo.filepath,function(err) {
|
|
|
|
if(err) {
|
|
|
|
return callback(err);
|
2013-10-11 21:10:10 +00:00
|
|
|
}
|
2014-02-14 07:53:41 +00:00
|
|
|
self.logger.log("Deleted file",fileInfo.filepath);
|
2014-02-06 21:36:30 +00:00
|
|
|
// Delete the metafile if present
|
|
|
|
if(fileInfo.hasMetaFile) {
|
2017-02-11 12:56:42 +00:00
|
|
|
fs.unlink(fileInfo.filepath + ".meta",function(err) {
|
2014-02-06 21:36:30 +00:00
|
|
|
if(err) {
|
|
|
|
return callback(err);
|
|
|
|
}
|
2017-02-11 12:56:42 +00:00
|
|
|
return $tw.utils.deleteEmptyDirs(path.dirname(fileInfo.filepath),callback);
|
2014-02-06 21:36:30 +00:00
|
|
|
});
|
|
|
|
} else {
|
2017-02-11 12:56:42 +00:00
|
|
|
return $tw.utils.deleteEmptyDirs(path.dirname(fileInfo.filepath),callback);
|
2014-02-06 21:36:30 +00:00
|
|
|
}
|
|
|
|
});
|
2013-03-25 20:16:12 +00:00
|
|
|
} else {
|
|
|
|
callback(null);
|
|
|
|
}
|
2013-03-24 12:22:21 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
if(fs) {
|
|
|
|
exports.adaptorClass = FileSystemAdaptor;
|
|
|
|
}
|
|
|
|
|
|
|
|
})();
|