Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
f4089d7a
Commit
f4089d7a
authored
May 03, 2015
by
Hugo Beauzée-Luyssen
Browse files
MediaLibrary: Handle file changes
parent
94ed95e3
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/MediaLibrary.cpp
View file @
f4089d7a
...
...
@@ -340,7 +340,8 @@ void MediaLibrary::checkFiles( fs::IDirectory* folder, unsigned int parentId )
files
.
erase
(
it
);
continue
;
}
//FIXME: What should we do when a file is modified?! Delete & re-add?
deleteFile
(
filePath
);
addFile
(
file
.
get
(),
parentId
);
files
.
erase
(
it
);
}
for
(
auto
file
:
files
)
...
...
test/Folders.cpp
View file @
f4089d7a
...
...
@@ -53,6 +53,11 @@ public:
return
m_lastModification
;
}
void
markAsModified
()
{
m_lastModification
++
;
}
std
::
string
m_name
;
std
::
string
m_path
;
std
::
string
m_fullPath
;
...
...
@@ -458,3 +463,22 @@ TEST_F( Folders, RemoveDirectory )
ASSERT_EQ
(
nullptr
,
f
);
ASSERT_EQ
(
nullptr
,
file
);
}
TEST_F
(
Folders
,
UpdateFile
)
{
ml
->
addFolder
(
"."
);
auto
filePath
=
std
::
string
{
mock
::
FileSystemFactory
::
SubFolder
}
+
"subfile.mp4"
;
auto
f
=
ml
->
file
(
filePath
);
auto
id
=
f
->
id
();
ml
.
reset
();
fsMock
->
files
[
filePath
]
->
markAsModified
();
fsMock
->
dirs
[
mock
::
FileSystemFactory
::
SubFolder
]
->
markAsModified
();
Reload
();
f
=
ml
->
file
(
filePath
);
ASSERT_NE
(
nullptr
,
f
);
// The file is expected to be deleted and re-added since it changed, so the
// id should have changed
ASSERT_NE
(
id
,
f
->
id
()
);
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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