mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-10 20:09:57 +00:00
Filesystem adaptor should not crash with missing wiki folder
This commit is contained in:
parent
b8fb9e6b21
commit
38081b86c9
@ -22,8 +22,10 @@ function FileSystemAdaptor(options) {
|
|||||||
this.boot = options.boot || $tw.boot;
|
this.boot = options.boot || $tw.boot;
|
||||||
this.logger = new $tw.utils.Logger("filesystem",{colour: "blue"});
|
this.logger = new $tw.utils.Logger("filesystem",{colour: "blue"});
|
||||||
// Create the <wiki>/tiddlers folder if it doesn't exist
|
// Create the <wiki>/tiddlers folder if it doesn't exist
|
||||||
|
if(this.boot.wikiTiddlersPath) {
|
||||||
$tw.utils.createDirectory(this.boot.wikiTiddlersPath);
|
$tw.utils.createDirectory(this.boot.wikiTiddlersPath);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FileSystemAdaptor.prototype.name = "filesystem";
|
FileSystemAdaptor.prototype.name = "filesystem";
|
||||||
|
|
||||||
@ -52,6 +54,10 @@ The type is found by looking up the extension in $tw.config.fileExtensionInfo (e
|
|||||||
It is the responsibility of the filesystem adaptor to update this.boot.files for new files that are created.
|
It is the responsibility of the filesystem adaptor to update this.boot.files for new files that are created.
|
||||||
*/
|
*/
|
||||||
FileSystemAdaptor.prototype.getTiddlerFileInfo = function(tiddler,callback) {
|
FileSystemAdaptor.prototype.getTiddlerFileInfo = function(tiddler,callback) {
|
||||||
|
// Error if we don't have a this.boot.wikiTiddlersPath
|
||||||
|
if(!this.boot.wikiTiddlersPath) {
|
||||||
|
return callback("filesystemadaptor requires a valid wiki folder");
|
||||||
|
}
|
||||||
// Always generate a fileInfo object when this fuction is called
|
// Always generate a fileInfo object when this fuction is called
|
||||||
var title = tiddler.fields.title, newInfo, pathFilters, extFilters,
|
var title = tiddler.fields.title, newInfo, pathFilters, extFilters,
|
||||||
fileInfo = this.boot.files[title];
|
fileInfo = this.boot.files[title];
|
||||||
|
Loading…
Reference in New Issue
Block a user