Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
VideoLAN
medialibrary
Commits
467483d7
Commit
467483d7
authored
Dec 04, 2015
by
Hugo Beauzée-Luyssen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fs factory: Return folders as shared_ptr
parent
3972cbce
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
8 additions
and
8 deletions
+8
-8
include/factory/IFileSystem.h
include/factory/IFileSystem.h
+1
-1
src/discoverer/FsDiscoverer.cpp
src/discoverer/FsDiscoverer.cpp
+1
-1
src/factory/FileSystem.cpp
src/factory/FileSystem.cpp
+2
-2
src/factory/FileSystem.h
src/factory/FileSystem.h
+1
-1
test/mocks/FileSystem.h
test/mocks/FileSystem.h
+3
-3
No files found.
include/factory/IFileSystem.h
View file @
467483d7
...
...
@@ -41,7 +41,7 @@ namespace factory
/// \brief createDirectory creates a representation of a directory
/// \param path An absolute path to a directory
///
virtual
std
::
unique
_ptr
<
fs
::
IDirectory
>
createDirectory
(
const
std
::
string
&
path
)
=
0
;
virtual
std
::
shared
_ptr
<
fs
::
IDirectory
>
createDirectory
(
const
std
::
string
&
path
)
=
0
;
///
/// \brief createFile creates a representation of a file
/// \param fileName an absolute path to a file
...
...
src/discoverer/FsDiscoverer.cpp
View file @
467483d7
...
...
@@ -54,7 +54,7 @@ bool FsDiscoverer::discover( const std::string &entryPoint )
return
true
;
}
// Otherwise, create a directory, and check it for modifications
std
::
unique
_ptr
<
fs
::
IDirectory
>
fsDir
;
std
::
shared
_ptr
<
fs
::
IDirectory
>
fsDir
;
try
{
fsDir
=
m_fsFactory
->
createDirectory
(
entryPoint
);
...
...
src/factory/FileSystem.cpp
View file @
467483d7
...
...
@@ -37,9 +37,9 @@
namespace
factory
{
std
::
unique
_ptr
<
fs
::
IDirectory
>
FileSystemDefaultFactory
::
createDirectory
(
const
std
::
string
&
path
)
std
::
shared
_ptr
<
fs
::
IDirectory
>
FileSystemDefaultFactory
::
createDirectory
(
const
std
::
string
&
path
)
{
return
std
::
unique
_ptr
<
fs
::
IDirectory
>
(
new
fs
::
Directory
(
path
)
);
return
std
::
shared
_ptr
<
fs
::
IDirectory
>
(
new
fs
::
Directory
(
path
)
);
}
std
::
unique_ptr
<
fs
::
IFile
>
FileSystemDefaultFactory
::
createFile
(
const
std
::
string
&
fileName
)
...
...
src/factory/FileSystem.h
View file @
467483d7
...
...
@@ -29,7 +29,7 @@ namespace factory
class
FileSystemDefaultFactory
:
public
IFileSystem
{
public:
virtual
std
::
unique
_ptr
<
fs
::
IDirectory
>
createDirectory
(
const
std
::
string
&
path
)
override
;
virtual
std
::
shared
_ptr
<
fs
::
IDirectory
>
createDirectory
(
const
std
::
string
&
path
)
override
;
virtual
std
::
unique_ptr
<
fs
::
IFile
>
createFile
(
const
std
::
string
&
fileName
)
override
;
};
}
test/mocks/FileSystem.h
View file @
467483d7
...
...
@@ -231,7 +231,7 @@ struct FileSystemFactory : public factory::IFileSystem
dirs
.
erase
(
it
);
}
virtual
std
::
unique
_ptr
<
fs
::
IDirectory
>
createDirectory
(
const
std
::
string
&
path
)
override
virtual
std
::
shared
_ptr
<
fs
::
IDirectory
>
createDirectory
(
const
std
::
string
&
path
)
override
{
mock
::
Directory
*
res
=
nullptr
;
if
(
path
==
"."
)
...
...
@@ -246,7 +246,7 @@ struct FileSystemFactory : public factory::IFileSystem
}
if
(
res
==
nullptr
)
throw
std
::
runtime_error
(
"Invalid path"
);
return
std
::
unique
_ptr
<
fs
::
IDirectory
>
(
new
Directory
(
*
res
)
);
return
std
::
shared
_ptr
<
fs
::
IDirectory
>
(
new
Directory
(
*
res
)
);
}
virtual
std
::
unique_ptr
<
fs
::
IFile
>
createFile
(
const
std
::
string
&
filePath
)
override
...
...
@@ -307,7 +307,7 @@ public:
class
NoopFsFactory
:
public
factory
::
IFileSystem
{
public:
virtual
std
::
unique
_ptr
<
fs
::
IDirectory
>
createDirectory
(
const
std
::
string
&
)
override
virtual
std
::
shared
_ptr
<
fs
::
IDirectory
>
createDirectory
(
const
std
::
string
&
)
override
{
return
nullptr
;
}
...
...
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