Skip to content

Commit 7302c7c

Browse files
committed
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.
1 parent 272850a commit 7302c7c

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

lib/Drivers/DML/sqlite.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,11 @@ function Driver(config, connection, opts) {
1414
// on Windows, paths have a drive letter which is parsed by
1515
// url.parse() as the hostname. If host is defined, assume
1616
// it's the drive letter and add ":"
17-
this.db = new sqlite3.Database(((config.host ? config.host + ":" : "") + (config.pathname || "")) || ':memory:');
17+
if (process.platform == "win32" && config.host.match(/^[a-z]$/i)) {
18+
this.db = new sqlite3.Database(((config.host ? config.host + ":" : "") + (config.pathname || "")) || ':memory:');
19+
} else {
20+
this.db = new sqlite3.Database(((config.host ? config.host : "") + (config.pathname || "")) || ':memory:');
21+
}
1822
}
1923

2024
this.aggregate_functions = [ "ABS", "ROUND",

0 commit comments

Comments
 (0)