Creating a file in ~/.config (ubuntu)

Bystroushaak bystrousak at kitakitsune.org
Fri Apr 13 09:40:45 PDT 2012


Use std.path.expandTilde() ->
http://dlang.org/phobos/std_path.html#expandTilde

On 13.4.2012 18:02, Minas wrote:
> I am trying to create a file in ~/.config
> My code is:
> 
> [code]
> import std.stdio;
> 
> void main()
> {
>     auto f = File("~/.config/minas.txt", "w");
> }
> [/code]
> 
> However, an exception is thrown.
> 
> std.exception.ErrnoException at std/stdio.d(288): Cannot open file
> `~/.config/minas.txt' in mode `w' (No such file or directory)
> ----------------
> ./test(std.stdio.File std.stdio.File.__ctor(immutable(char)[],
> const(char[]))+0x5c) [0x41a5ac]
> ./test(_Dmain+0x32) [0x41892a]
> ./test(extern (C) int rt.dmain2.main(int, char**).void runMain()+0x17)
> [0x419597]
> ./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope
> void delegate())+0x2a) [0x418f0e]
> ./test(extern (C) int rt.dmain2.main(int, char**).void runAll()+0x42)
> [0x4195ea]
> ./test(extern (C) int rt.dmain2.main(int, char**).void tryExec(scope
> void delegate())+0x2a) [0x418f0e]
> ./test(main+0xd3) [0x418e9f]
> /lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xed) [0x7ff3dcb4830d]
> 
> 
> When trying to create it in the current directory(~/Deskto) it works
> fine. I guess it has something to do with access rights.
> Is there something I can do to run it with higher access priviliges?
> 
> (I know that this might not have to do with D but I thought this would
> be a good place to ask)
> 
> Thanks in advance.


More information about the Digitalmars-d-learn mailing list