Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
T
tg
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
tg
Commits
fab13d77
Commit
fab13d77
authored
Oct 10, 2014
by
mk-pmb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add support for XDG_CONFIG_HOME as per FreeDesktop basedir spec
parent
9804997b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
main.c
main.c
+10
-0
No files found.
main.c
View file @
fab13d77
...
...
@@ -180,6 +180,15 @@ char *get_config_directory (void) {
char
*
config_directory
;
config_directory
=
getenv
(
"TELEGRAM_CONFIG_DIR"
);
if
(
!
str_empty
(
config_directory
))
{
return
tstrdup
(
config_directory
);
}
// XDG: http://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html
config_directory
=
getenv
(
"XDG_CONFIG_HOME"
);
if
(
!
str_empty
(
config_directory
))
{
tasprintf
(
&
config_directory
,
"%s/"
PROG_NAME
,
config_directory
);
// :TODO: someone check whether it could be required to pass tasprintf
// a tstrdup()ed config_directory instead; works for me without.
// should work b/c this scope's lifespan encompasses tasprintf()
return
config_directory
;
}
tasprintf
(
&
config_directory
,
"%s/"
CONFIG_DIRECTORY
,
get_home_directory
());
return
config_directory
;
}
...
...
@@ -238,6 +247,7 @@ void running_for_first_time (void) {
int
config_file_fd
;
char
*
config_directory
=
get_config_directory
();
printf
(
"I: config dir=[%s]
\n
"
,
config_directory
);
//char *downloads_directory = get_downloads_directory ();
if
(
!
mkdir
(
config_directory
,
CONFIG_DIRECTORY_MODE
))
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment