diff options
author | Matthias Schiffer <mschiffer@universe-factory.net> | 2010-07-17 13:30:16 +0200 |
---|---|---|
committer | Matthias Schiffer <mschiffer@universe-factory.net> | 2010-07-17 13:30:16 +0200 |
commit | b66c4b8549bc64aae8780a98851ea59850024a58 (patch) | |
tree | 9310d7b940ad59dec23379a70bd3d6ec452215bc /src/core/ephraim_util.erl | |
parent | 4716cfc2cbf012a070fec8db4856c1761f8a50ee (diff) | |
download | ephraim-b66c4b8549bc64aae8780a98851ea59850024a58.tar ephraim-b66c4b8549bc64aae8780a98851ea59850024a58.zip |
Added function to get config dir.
Diffstat (limited to 'src/core/ephraim_util.erl')
-rw-r--r-- | src/core/ephraim_util.erl | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/core/ephraim_util.erl b/src/core/ephraim_util.erl index 73cb7fc..cdf9cea 100644 --- a/src/core/ephraim_util.erl +++ b/src/core/ephraim_util.erl @@ -8,3 +8,21 @@ send_all(Dest, Message) -> -spec send_all_values(dict(), term()) -> term(). send_all_values(Dest, Message) -> dict:fold(fun(_,Value,Msg) -> Value ! Msg end, Message, Dest). + +-spec config_path() -> string(). +config_path() -> + Path = case os:getenv("XDG_CONFIG_HOME") of + false -> + os:getenv("HOME") ++ "/.config"; + ConfigHome -> + ConfigHome + end ++ "/ephraim", + case file:read_file_info(Path) of + {ok, _} -> + ok; + {error, _} -> + file:make_dir(Path) + end, + Path. + + |