Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
786f7e30
Commit
786f7e30
authored
May 05, 2008
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't duplicate getenv("HOME")
parent
d73e233d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
11 deletions
+8
-11
src/config/core.c
src/config/core.c
+8
-11
No files found.
src/config/core.c
View file @
786f7e30
...
...
@@ -699,29 +699,26 @@ static char *config_GetFooDir (const char *xdg_name, const char *xdg_default)
free
(
psz_parent
);
(
void
)
xdg_name
;
(
void
)
xdg_default
;
#else
char
var
[
sizeof
(
"XDG__HOME"
)
+
strlen
(
xdg_name
)]
,
*
psz_env
;
char
var
[
sizeof
(
"XDG__HOME"
)
+
strlen
(
xdg_name
)];
/* XDG Base Directory Specification - Version 0.6 */
snprintf
(
var
,
sizeof
(
var
),
"XDG_%s_HOME"
,
xdg_name
);
char
*
psz_home
=
getenv
(
var
);
psz_
env
=
psz_home
?
FromLocaleDup
(
psz_home
)
:
NULL
;
if
(
psz_
env
)
psz_
home
=
psz_home
?
FromLocaleDup
(
psz_home
)
:
NULL
;
if
(
psz_
home
)
{
if
(
asprintf
(
&
psz_dir
,
"%s/vlc"
,
psz_
env
)
==
-
1
)
if
(
asprintf
(
&
psz_dir
,
"%s/vlc"
,
psz_
home
)
==
-
1
)
psz_dir
=
NULL
;
goto
out
;
}
psz_home
=
getenv
(
"HOME"
);
psz_env
=
psz_home
?
FromLocaleDup
(
psz_home
)
:
NULL
;
/* not part of XDG spec but we want a sensible fallback */
if
(
!
psz_env
)
psz_env
=
config_GetHomeDir
();
if
(
asprintf
(
&
psz_dir
,
"%s/%s/vlc"
,
psz_env
,
xdg_default
)
==
-
1
)
/* Try HOME, then fallback to non-XDG dirs */
psz_home
=
config_GetHomeDir
();
if
(
asprintf
(
&
psz_dir
,
"%s/%s/vlc"
,
psz_home
,
xdg_default
)
==
-
1
)
psz_dir
=
NULL
;
out:
free
(
psz_
env
);
free
(
psz_
home
);
#endif
return
psz_dir
;
}
...
...
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