From 7302c7cf0e4f3beb644cecdd2b7f59254ec76439 Mon Sep 17 00:00:00 2001 From: Diogo Resende Date: Fri, 2 Aug 2013 22:37:52 +0100 Subject: [PATCH] Changes the way ":" is added to sqlite db paths (#270) 1. Only add on win32 platforms 2. Only add if host is a letter The only case this can't avoid (right now) is realtive paths where the first folder is a letter. Please avoid it. --- lib/Drivers/DML/sqlite.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Drivers/DML/sqlite.js b/lib/Drivers/DML/sqlite.js index 16d49a85..1edf1f17 100644 --- a/lib/Drivers/DML/sqlite.js +++ b/lib/Drivers/DML/sqlite.js @@ -14,7 +14,11 @@ function Driver(config, connection, opts) { // on Windows, paths have a drive letter which is parsed by // url.parse() as the hostname. If host is defined, assume // it's the drive letter and add ":" - this.db = new sqlite3.Database(((config.host ? config.host + ":" : "") + (config.pathname || "")) || ':memory:'); + if (process.platform == "win32" && config.host.match(/^[a-z]$/i)) { + this.db = new sqlite3.Database(((config.host ? config.host + ":" : "") + (config.pathname || "")) || ':memory:'); + } else { + this.db = new sqlite3.Database(((config.host ? config.host : "") + (config.pathname || "")) || ':memory:'); + } } this.aggregate_functions = [ "ABS", "ROUND",