Merge pull request #17 from dymk/windows-fixes
Add configuration file support for Windows
This commit is contained in:
commit
59a279da32
|
@ -0,0 +1,3 @@
|
||||||
|
# Windows binaries
|
||||||
|
*.exe
|
||||||
|
*.obj
|
|
@ -110,7 +110,7 @@ In future versions the client may start the server if it is not running, but for
|
||||||
now it must be started manually.
|
now it must be started manually.
|
||||||
|
|
||||||
## Configuration Files
|
## Configuration Files
|
||||||
The server will attempt to read the file ```~/.config/dcd``` on startup.
|
The server will attempt to read the file ```~/.config/dcd``` on Posix systems, or ```dcd.conf``` on Windows in the current working directory on startup.
|
||||||
If it exists, each line of the file is interpreted as a path that should be
|
If it exists, each line of the file is interpreted as a path that should be
|
||||||
searched when looking for module imports.
|
searched when looking for module imports.
|
||||||
|
|
||||||
|
|
|
@ -88,7 +88,7 @@ struct ModuleCache
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
File f = File(location);
|
File f = File(location);
|
||||||
ubyte[] source = uninitializedArray!(ubyte[])(f.size);
|
ubyte[] source = uninitializedArray!(ubyte[])(cast(size_t)f.size);
|
||||||
f.rawRead(source);
|
f.rawRead(source);
|
||||||
|
|
||||||
LexerConfig config;
|
LexerConfig config;
|
||||||
|
|
33
server.d
33
server.d
|
@ -32,8 +32,14 @@ import messages;
|
||||||
import autocomplete;
|
import autocomplete;
|
||||||
import modulecache;
|
import modulecache;
|
||||||
|
|
||||||
// TODO: Portability would be nice...
|
version(Posix)
|
||||||
enum CONFIG_FILE_PATH = "~/.config/dcd";
|
{
|
||||||
|
enum CONFIG_FILE_PATH = "~/.config/dcd";
|
||||||
|
}
|
||||||
|
else version(Windows)
|
||||||
|
{
|
||||||
|
enum CONFIG_FILE_PATH = "dcd.conf";
|
||||||
|
}
|
||||||
|
|
||||||
int main(string[] args)
|
int main(string[] args)
|
||||||
{
|
{
|
||||||
|
@ -135,19 +141,22 @@ int main(string[] args)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
version(linux)
|
|
||||||
{
|
|
||||||
string[] loadConfiguredImportDirs()
|
string[] loadConfiguredImportDirs()
|
||||||
{
|
{
|
||||||
string fullPath = expandTilde(CONFIG_FILE_PATH);
|
version(Windows)
|
||||||
if (!exists(fullPath))
|
{
|
||||||
return [];
|
string fullPath = buildPath(getcwd(), CONFIG_FILE_PATH);
|
||||||
File f = File(fullPath);
|
}
|
||||||
return f.byLine(KeepTerminator.no).map!(a => a.idup).filter!(a => a.exists()).array();
|
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();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
else
|
|
||||||
static assert (false, "Only Linux is supported at the moment");
|
|
||||||
|
|
||||||
void printHelp(string programName)
|
void printHelp(string programName)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue