Skip to content

Commit

Permalink
Move LocalFileWatcher to linux directory, as it is specific for Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
sbusch42 committed Jan 6, 2019
1 parent 60c8fb1 commit b45312a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 5 deletions.
14 changes: 11 additions & 3 deletions source/cppfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ set(headers
${include_path}/${localfs}/LocalFileSystem.h
${include_path}/${localfs}/LocalFileHandle.h
${include_path}/${localfs}/LocalFileIterator.h
${include_path}/${localfs}/LocalFileWatcher.h
)

set(sources
Expand Down Expand Up @@ -105,9 +104,18 @@ set(sources
${source_path}/${localfs}/LocalFileSystem.cpp
${source_path}/${localfs}/LocalFileHandle.cpp
${source_path}/${localfs}/LocalFileIterator.cpp
${source_path}/${localfs}/LocalFileWatcher.cpp
)

if("${CMAKE_SYSTEM_NAME}" MATCHES "Linux")
set(headers ${headers}
${include_path}/linux/LocalFileWatcher.h
)

set(sources ${sources}
${source_path}/linux/LocalFileWatcher.cpp
)
endif()

if (OPTION_BUILD_SSH_BACKEND)
set(headers ${headers}
${include_path}/ssh/SshFileSystem.h
Expand All @@ -124,7 +132,7 @@ if (OPTION_BUILD_SSH_BACKEND)
${source_path}/ssh/SshInputStreamBuffer.cpp
${source_path}/ssh/SshOutputStreamBuffer.cpp
)
endif ()
endif()

# Group source files
set(header_group "Header Files (API)")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#include <cppfs/posix/LocalFileWatcher.h>
#include <cppfs/linux/LocalFileWatcher.h>

#include <unistd.h>
#include <limits.h>
Expand Down
10 changes: 9 additions & 1 deletion source/cppfs/source/posix/LocalFileSystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

#include <cppfs/FileHandle.h>
#include <cppfs/FileWatcher.h>
#include <cppfs/AbstractFileWatcherBackend.h>
#include <cppfs/posix/LocalFileHandle.h>
#include <cppfs/posix/LocalFileWatcher.h>

#ifdef SYSTEM_LINUX
#include <cppfs/linux/LocalFileWatcher.h>
#endif


namespace cppfs
Expand Down Expand Up @@ -35,9 +39,13 @@ FileHandle LocalFileSystem::open(std::string && path)

std::unique_ptr<AbstractFileWatcherBackend> LocalFileSystem::createFileWatcher(FileWatcher & fileWatcher)
{
#ifdef SYSTEM_LINUX
return std::unique_ptr<AbstractFileWatcherBackend>(
new LocalFileWatcher(&fileWatcher, shared_from_this())
);
#else
return nullptr;
#endif
}


Expand Down

0 comments on commit b45312a

Please sign in to comment.