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
a8c111dd
Commit
a8c111dd
authored
Aug 26, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Win32: refactor and implement pictures directory
parent
47d017dd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
18 deletions
+20
-18
src/config/dirs_win.c
src/config/dirs_win.c
+20
-18
No files found.
src/config/dirs_win.c
View file @
a8c111dd
...
@@ -53,10 +53,15 @@ const char *config_GetDataDir( void )
...
@@ -53,10 +53,15 @@ const char *config_GetDataDir( void )
return
path
;
return
path
;
}
}
static
const
char
*
GetDir
(
bool
b_common
)
const
char
*
config_GetConfDir
(
void
)
{
{
static
char
appdir
[
PATH_MAX
]
=
""
;
wchar_t
wdir
[
MAX_PATH
];
wchar_t
wdir
[
MAX_PATH
];
#warning FIXME: thread-safety!
if
(
*
appdir
)
return
appdir
;
#if defined (UNDER_CE)
#if defined (UNDER_CE)
/*There are some errors in cegcc headers*/
/*There are some errors in cegcc headers*/
#undef SHGetSpecialFolderPath
#undef SHGetSpecialFolderPath
...
@@ -64,27 +69,18 @@ static const char *GetDir( bool b_common )
...
@@ -64,27 +69,18 @@ static const char *GetDir( bool b_common )
if
(
SHGetSpecialFolderPath
(
NULL
,
wdir
,
CSIDL_APPDATA
,
1
)
)
if
(
SHGetSpecialFolderPath
(
NULL
,
wdir
,
CSIDL_APPDATA
,
1
)
)
#else
#else
/* Get the "Application Data" folder for the current user */
/* Get the "Application Data" folder for the current user */
if
(
S_OK
==
SHGetFolderPathW
(
NULL
,
(
b_common
?
CSIDL_COMMON_APPDATA
if
(
S_OK
==
SHGetFolderPathW
(
NULL
,
CSIDL_COMMON_APPDATA
:
CSIDL_APPDATA
)
|
CSIDL_FLAG_CREATE
,
NULL
,
SHGFP_TYPE_CURRENT
,
wdir
)
)
|
CSIDL_FLAG_CREATE
,
NULL
,
SHGFP_TYPE_CURRENT
,
wdir
)
)
#endif
#endif
{
{
static
char
appdir
[
PATH_MAX
]
=
""
;
static
char
comappdir
[
PATH_MAX
]
=
""
;
WideCharToMultiByte
(
CP_UTF8
,
0
,
wdir
,
-
1
,
WideCharToMultiByte
(
CP_UTF8
,
0
,
wdir
,
-
1
,
b_common
?
comappdir
:
appdir
,
appdir
,
PATH_MAX
,
NULL
,
NULL
);
PATH_MAX
,
NULL
,
NULL
);
return
appdir
;
return
b_common
?
comappdir
:
appdir
;
}
}
return
NULL
;
return
NULL
;
}
}
const
char
*
config_GetConfDir
(
void
)
static
char
*
config_GetShellDir
(
int
csidl
)
{
return
GetDir
(
true
);
}
static
char
*
config_GetHomeDir
(
void
)
{
{
wchar_t
wdir
[
MAX_PATH
];
wchar_t
wdir
[
MAX_PATH
];
...
@@ -94,7 +90,7 @@ static char *config_GetHomeDir (void)
...
@@ -94,7 +90,7 @@ static char *config_GetHomeDir (void)
BOOL
WINAPI
SHGetSpecialFolderPath
(
HWND
,
LPWSTR
,
int
,
BOOL
);
BOOL
WINAPI
SHGetSpecialFolderPath
(
HWND
,
LPWSTR
,
int
,
BOOL
);
if
(
SHGetSpecialFolderPath
(
NULL
,
wdir
,
CSIDL_APPDATA
,
1
))
if
(
SHGetSpecialFolderPath
(
NULL
,
wdir
,
CSIDL_APPDATA
,
1
))
#else
#else
if
(
SHGetFolderPathW
(
NULL
,
CSIDL_PERSONAL
|
CSIDL_FLAG_CREATE
,
if
(
SHGetFolderPathW
(
NULL
,
csidl
|
CSIDL_FLAG_CREATE
,
NULL
,
SHGFP_TYPE_CURRENT
,
wdir
)
==
S_OK
)
NULL
,
SHGFP_TYPE_CURRENT
,
wdir
)
==
S_OK
)
#endif
#endif
return
FromWide
(
wdir
);
return
FromWide
(
wdir
);
...
@@ -104,10 +100,12 @@ static char *config_GetHomeDir (void)
...
@@ -104,10 +100,12 @@ static char *config_GetHomeDir (void)
static
char
*
config_GetAppDir
(
void
)
static
char
*
config_GetAppDir
(
void
)
{
{
char
*
psz_dir
;
char
*
psz_dir
;
c
onst
char
*
psz_parent
=
GetDir
(
false
);
c
har
*
psz_parent
=
config_GetShellDir
(
CSIDL_APPDATA
);
if
(
asprintf
(
&
psz_dir
,
"%s
\\
vlc"
,
psz_parent
)
==
-
1
)
if
(
psz_parent
==
NULL
||
asprintf
(
&
psz_dir
,
"%s
\\
vlc"
,
psz_parent
)
==
-
1
)
psz_dir
=
NULL
;
psz_dir
=
NULL
;
free
(
psz_parent
);
return
psz_dir
;
return
psz_dir
;
}
}
...
@@ -121,7 +119,7 @@ char *config_GetUserDir (vlc_userdir_t type)
...
@@ -121,7 +119,7 @@ char *config_GetUserDir (vlc_userdir_t type)
switch
(
type
)
switch
(
type
)
{
{
case
VLC_HOME_DIR
:
case
VLC_HOME_DIR
:
return
config_Get
HomeDir
(
);
return
config_Get
ShellDir
(
CSIDL_PERSONAL
);
case
VLC_CONFIG_DIR
:
case
VLC_CONFIG_DIR
:
return
config_GetAppDir
();
return
config_GetAppDir
();
case
VLC_DATA_DIR
:
case
VLC_DATA_DIR
:
...
@@ -132,8 +130,12 @@ char *config_GetUserDir (vlc_userdir_t type)
...
@@ -132,8 +130,12 @@ char *config_GetUserDir (vlc_userdir_t type)
case
VLC_PUBLICSHARE_DIR
:
case
VLC_PUBLICSHARE_DIR
:
case
VLC_DOCUMENTS_DIR
:
case
VLC_DOCUMENTS_DIR
:
case
VLC_MUSIC_DIR
:
case
VLC_MUSIC_DIR
:
#warning FIXME: unimplemented
return
config_GetUserDir
(
VLC_HOME_DIR
);
case
VLC_PICTURES_DIR
:
case
VLC_PICTURES_DIR
:
return
config_GetShellDir
(
CSIDL_MYPICTURES
);
case
VLC_VIDEOS_DIR
:
case
VLC_VIDEOS_DIR
:
#warning FIXME: unimplemented
return
config_GetUserDir
(
VLC_HOME_DIR
);
return
config_GetUserDir
(
VLC_HOME_DIR
);
}
}
assert
(
0
);
assert
(
0
);
...
...
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