allow using relative paths
This commit is contained in:
@@ -35,6 +35,17 @@ function MBTiles(uri, callback) {
|
||||
if (typeof callback !== 'function') callback = noop;
|
||||
if (typeof uri === 'string') uri = url.parse(uri);
|
||||
|
||||
if (!uri.pathname) {
|
||||
callback(new Error('Invalid URI ' + url.format(uri)));
|
||||
return;
|
||||
}
|
||||
|
||||
if (uri.hostname === '.') {
|
||||
delete uri.hostname;
|
||||
delete uri.host;
|
||||
uri.pathname = '.' + uri.pathname;
|
||||
}
|
||||
|
||||
this.filename = uri.pathname;
|
||||
Step(function() {
|
||||
mbtiles._db = new sqlite3.cached.Database(mbtiles.filename, this);
|
||||
|
||||
Reference in New Issue
Block a user