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
1b222b87
Commit
1b222b87
authored
Aug 02, 2009
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use Unicode paths for plugins scan and ignore non-regular files
parent
46d4efcd
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
48 deletions
+33
-48
src/modules/modules.c
src/modules/modules.c
+28
-45
src/modules/os.c
src/modules/os.c
+5
-3
No files found.
src/modules/modules.c
View file @
1b222b87
...
@@ -992,12 +992,8 @@ static void AllocatePluginDir( vlc_object_t *p_this, module_bank_t *p_bank,
...
@@ -992,12 +992,8 @@ static void AllocatePluginDir( vlc_object_t *p_this, module_bank_t *p_bank,
WIN32_FIND_DATA
finddata
;
WIN32_FIND_DATA
finddata
;
HANDLE
handle
;
HANDLE
handle
;
int
rc
;
int
rc
;
#else
int
i_dirlen
;
DIR
*
dir
;
struct
dirent
*
file
;
#endif
char
*
psz_file
;
char
*
psz_file
;
#endif
if
(
i_maxdepth
==
0
)
if
(
i_maxdepth
==
0
)
return
;
return
;
...
@@ -1093,58 +1089,45 @@ static void AllocatePluginDir( vlc_object_t *p_this, module_bank_t *p_bank,
...
@@ -1093,58 +1089,45 @@ static void AllocatePluginDir( vlc_object_t *p_this, module_bank_t *p_bank,
FindClose
(
handle
);
FindClose
(
handle
);
#else
#else
dir
=
opendir
(
psz_dir
);
DIR
*
dh
=
utf8_opendir
(
psz_dir
);
if
(
!
dir
)
if
(
dh
==
NULL
)
{
return
;
return
;
}
i_dirlen
=
strlen
(
psz_dir
);
/* Parse the directory and try to load all files it contains. */
/* Parse the directory and try to load all files it contains. */
while
(
(
file
=
readdir
(
dir
)
)
)
for
(;;
)
{
{
struct
stat
statbuf
;
char
*
file
=
utf8_readdir
(
dh
),
*
path
;
unsigned
int
i_len
;
struct
stat
st
;
int
i_stat
;
if
(
file
==
NULL
)
break
;
/* Skip ".", ".." */
/* Skip ".", ".." */
if
(
!*
file
->
d_name
||
!
strcmp
(
file
->
d_name
,
"."
)
if
(
!
strcmp
(
file
,
"."
)
||
!
strcmp
(
file
,
".."
))
||
!
strcmp
(
file
->
d_name
,
".."
)
)
{
{
free
(
file
);
continue
;
continue
;
}
}
i_len
=
strlen
(
file
->
d_name
);
const
int
pathlen
=
asprintf
(
&
path
,
"%s"
DIR_SEP
"%s"
,
psz_dir
,
file
);
psz_file
=
malloc
(
i_dirlen
+
1
+
i_len
+
1
);
free
(
file
);
sprintf
(
psz_file
,
"%s"
DIR_SEP
"%s"
,
psz_dir
,
file
->
d_name
);
if
(
pathlen
==
-
1
||
utf8_stat
(
path
,
&
st
))
continue
;
i_stat
=
stat
(
psz_file
,
&
statbuf
);
if
(
!
i_stat
&&
statbuf
.
st_mode
&
S_IFDIR
)
{
AllocatePluginDir
(
p_this
,
p_bank
,
psz_file
,
i_maxdepth
-
1
);
}
else
if
(
i_len
>
strlen
(
LIBEXT
)
/* We only load files ending with LIBEXT */
&&
!
strncasecmp
(
file
->
d_name
+
i_len
-
strlen
(
LIBEXT
),
LIBEXT
,
strlen
(
LIBEXT
)
)
)
{
int64_t
i_time
=
0
,
i_size
=
0
;
if
(
!
i_stat
)
{
i_time
=
statbuf
.
st_mtime
;
i_size
=
statbuf
.
st_size
;
}
AllocatePluginFile
(
p_this
,
p_bank
,
psz_file
,
i_time
,
i_size
);
if
(
S_ISDIR
(
st
.
st_mode
))
}
/* Recurse into another directory */
AllocatePluginDir
(
p_this
,
p_bank
,
path
,
i_maxdepth
-
1
);
else
if
(
S_ISREG
(
st
.
st_mode
)
&&
((
size_t
)
pathlen
>=
strlen
(
LIBEXT
))
&&
!
strncasecmp
(
path
+
pathlen
-
strlen
(
LIBEXT
),
LIBEXT
,
strlen
(
LIBEXT
)))
/* ^^ We only load files ending with LIBEXT */
AllocatePluginFile
(
p_this
,
p_bank
,
path
,
st
.
st_mtime
,
st
.
st_size
);
free
(
psz_file
);
free
(
path
);
}
}
closedir
(
dh
);
/* Close the directory */
closedir
(
dir
);
#endif
#endif
}
}
...
...
src/modules/os.c
View file @
1b222b87
...
@@ -30,6 +30,7 @@
...
@@ -30,6 +30,7 @@
#include <vlc_common.h>
#include <vlc_common.h>
#include <vlc_plugin.h>
/* MODULE_SUFFIX */
#include <vlc_plugin.h>
/* MODULE_SUFFIX */
#include <vlc_charset.h>
#include "libvlc.h"
#include "libvlc.h"
#include "modules.h"
#include "modules.h"
...
@@ -184,12 +185,13 @@ int module_Load( vlc_object_t *p_this, const char *psz_file,
...
@@ -184,12 +185,13 @@ int module_Load( vlc_object_t *p_this, const char *psz_file,
# else
# else
const
int
flags
=
0
;
const
int
flags
=
0
;
# endif
# endif
char
*
path
=
ToLocale
(
psz_file
);
handle
=
dlopen
(
psz_file
,
flags
);
handle
=
dlopen
(
path
,
flags
);
LocaleFree
(
path
);
if
(
handle
==
NULL
)
if
(
handle
==
NULL
)
{
{
msg_Warn
(
p_this
,
"cannot load module `%s' (%s)"
,
msg_Warn
(
p_this
,
"cannot load module `%s' (%s)"
,
path
,
dlerror
()
);
psz_file
,
dlerror
()
);
return
-
1
;
return
-
1
;
}
}
...
...
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