Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
693654c6
Commit
693654c6
authored
Aug 22, 2016
by
Hugo Beauzée-Luyssen
Browse files
fs: win32: Fix directory listing
parent
40265fd4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/filesystem/win32/Directory.cpp
View file @
693654c6
...
...
@@ -47,26 +47,18 @@ Directory::Directory(const std::string& path , factory::IFileSystem& fsFactory)
void
Directory
::
read
()
const
{
WIN32_FIND_DATA
f
;
auto
wpath
=
charset
::
ToWide
(
m_path
.
c_str
()
);
auto
h
=
FindFirstFile
(
wpath
.
get
(),
&
f
);
auto
pattern
=
m_path
+
'*'
;
auto
wpattern
=
charset
::
ToWide
(
pattern
.
c_str
()
);
auto
h
=
FindFirstFile
(
wpattern
.
get
(),
&
f
);
if
(
h
==
INVALID_HANDLE_VALUE
)
throw
std
::
runtime_error
(
"Failed to browse through "
+
m_path
);
try
do
{
do
{
if
(
(
f
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
!=
0
)
{
m_dirs
.
emplace_back
(
m_fsFactory
.
createDirectory
(
charset
::
FromWide
(
f
.
cFileName
).
get
()
)
);
}
else
{
m_files
.
emplace_back
(
std
::
make_shared
<
File
>
(
charset
::
FromWide
(
f
.
cFileName
).
get
()
)
);
}
}
while
(
FindNextFile
(
h
,
&
f
)
!=
0
);
}
catch
(...){}
if
(
(
f
.
dwFileAttributes
&
FILE_ATTRIBUTE_DIRECTORY
)
!=
0
)
m_dirs
.
emplace_back
(
m_fsFactory
.
createDirectory
(
charset
::
FromWide
(
f
.
cFileName
).
get
()
)
);
else
m_files
.
emplace_back
(
std
::
make_shared
<
File
>
(
charset
::
FromWide
(
f
.
cFileName
).
get
()
)
);
}
while
(
FindNextFile
(
h
,
&
f
)
!=
0
);
FindClose
(
h
);
}
...
...
Write
Preview
Supports
Markdown
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