From 8cc0f2546d01a4cf442eca05f93c5a580c66271e Mon Sep 17 00:00:00 2001 From: Hackerpilot Date: Sun, 1 Sep 2013 02:23:01 -0700 Subject: [PATCH] Issue #8 Fixed configuration file parsing: byLine requires that the file be opened in text mode to properly handle CRLF line endings. Added build batch file. --- build.bat | 2 ++ server.d | 25 +++++++++++++------------ 2 files changed, 15 insertions(+), 12 deletions(-) create mode 100644 build.bat diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..e47abc3 --- /dev/null +++ b/build.bat @@ -0,0 +1,2 @@ +dmd -wi client.d messages.d msgpack-d/src/msgpack.d -Imsgpack-d/src -ofdcd-client -L/exet:nt/su:windows:4.0 +dmd -wi -g server.d modulecache.d actypes.d messages.d constants.d acvisitor.d autocomplete.d dscanner/stdx/d/ast.d dscanner/stdx/d/parser.d dscanner/stdx/d/lexer.d dscanner/stdx/d/entities.d msgpack-d/src/msgpack.d -Imsgpack-d/src -Idscanner/ -ofdcd-server diff --git a/server.d b/server.d index 33e7800..5b746cf 100644 --- a/server.d +++ b/server.d @@ -143,19 +143,20 @@ int main(string[] args) string[] loadConfiguredImportDirs() { - version(Windows) - { - string fullPath = buildPath(getcwd(), CONFIG_FILE_PATH); - } - else version(Posix) - { - string fullPath = expandTilde(CONFIG_FILE_PATH); - } + version(Windows) + { + string fullPath = buildPath(getcwd(), CONFIG_FILE_PATH); + } + else version(Posix) + { + string fullPath = expandTilde(CONFIG_FILE_PATH); + } - if (!exists(fullPath)) - return []; - File f = File(fullPath); - return f.byLine(KeepTerminator.no).map!(a => a.idup).filter!(a => a.exists()).array(); + if (!exists(fullPath)) + return []; + + File f = File(fullPath, "rt"); + return f.byLine(KeepTerminator.no).map!(a => a.idup).filter!(a => a.exists()).array(); } void printHelp(string programName)